Using a loop, define function any7s(n), which takes an integer n and returns true if the usual (base 10) representation of n contains a 7. For example, any7s(274) = true, but any7s(99) = false. Assume that the argument has type int. The answer has type boolean.

(Hint. Successively divide the number by 10. You are searching for a number whose rightmost digit is a 7. The search is exhausted when the number is 0. For example, when n is 3791, you look at 3791, 379, 37, and stop, because the rightmost digit of 37 is 7. When n is 999, you look at 999, 99, 9, 0, and stop because the search has reached 0. So only keep searching when you current number is not 0 and does not have rightmost digit 7.)

 

    [Language: Java  Kind: function definition]