Question: Write the function countSevens ( n ) . Given a non - negative int n , return the count of the occurrences of 7 as

Write the function countSevens(n). Given a non-negative int n, return the count of the occurrences of 7 as a digit, so for example 717 returns 2. You may not use any loops. Note that n %10 is the right digit, while n = n /10 removes the rightmost digit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!