Here is one question which one of my students, Vedant Sahai asked me. It appeared in his computer subject exam of his recent ICSE X exam (Mumbai):
write a program to accept a number from the user, and check if the number is a happy number or not; and the program has to display a message accordingly:
A Happy Number is defined as follows: take a positive number and replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (one). If the number ends with 1, then it is called a happy number.
For example: 31
Solution : 31 replaced by and 10 replaced by .
So, are you really happy? 🙂 🙂 🙂