admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Happy Number

Suraj Ghimire
42 Posts

Write a Program to check if a Number is Happy number or not.

Eg: 32 is a happy Number.

Explaination:

3^2 + 2^2   = 13  sum of square of each digit.

1 ^2 + 3 ^2  =10  sum of square of each digit from previous output.

1^2 + 0^2.   = 1   So finally It ended in 1. Hence it is a happy Number.

 

Other Happy Numbers are 7, 28, 100, 320

Published By : Suraj Ghimire
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin