Friendly Numbers
A five-digit integer is said to be friendly if the leftmost digit is divisible by 1, the leftmost two digits are divisible by 2, the leftmost three digits are divisible by 3, the leftmost four digits are divisible by 4, and the leftmost five digits (the five-digit number itself) is divisible by 5. For example, the number 42325 is friendly because 4 is divisible by 1, 42 is divisible by 2, 423 is divisible by 3, 4232 is divisible by 4, and 42325 is divisible by 5. Write a program that prompts for a fi ve-digit integer and determines whether or not the number is “friendly.”
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here