Using recursion (and not a loop), define function num7s(n) in Java, which takes an integer n and returns the number of 7s in the usual (base 10) representation of n. For example, num7s(2770) = 2 and num7s(99) = 0. Assume that the argument and answer both have type int.

(Hint. It is obvious what num7s(0) is. For values of n that are greater than 0, look at the rightmost digit of n. If the rightmost digit is a 7, then n has one more 7 then n/10. For example, num7s(3757) is one bigger than num7s(375). If the rightmost digit is not 7, then n has the same number of sevens as n/10.)

 

    [Language: Java  Kind: function definition]