Write a program in Java to input a number and check if the number is a friendly number or
not. A number is a friendly number if the sum of its digits is divisible by 9.
Answers
Answered by
3
Answer:
Algorithm to check whether the given numbers are friendly pair or not
Input the numbers num1 and num2.
Initialize sum1 = sum2 = 0.
sum1 = sum of all divisors of num1.
sum2 = sum of all divisors of num2.
If (sum1 == num1) and (sum2 == num2), then print "Abundant Numbers".
Else, print "Not Abundant Numbers".
Answered by
2
Algorithm to check whether the given numbers are friendly pair or not
Input the numbers num1 and num2.
Initialize sum1 = sum2 = 0.
sum1 = sum of all divisors of num1.
sum2 = sum of all divisors of num2.
If (sum1 == num1) and (sum2 == num2), then print "Abundant Numbers".
Else, print "Not Abundant Numbers
Similar questions