+ 3
How to write a program in java for a happy number
happy number is a number whose ultimate sum is 1. eg.lets take the number 82. sum of its digits is 10. and sum of digits of 10 is 1. so 82 is a happy number.
3 Respuestas
+ 4
try to write a block of code which calculates the sum of the digits, then for example execute this code in a while (sum < 10) , now it will calculate the sum, till the sum is smaller than 10, almost finished just pus a simple if statement and check if the sum is 1
that's it
note, I am not writing any code, because I won't you to learn something, and not just get the answer
hope this helps ^^
+ 1
I have written