Happy Number

Write a Java program to check if the given number is happy or not is a commonly asked coding interview question. To solve this problem, first we need to know what is a happy number? Take any positive integer, find the sum of the squares of its digits, repeat this process until you get 1 or if the sum equals 4(i.e repeats the cycle again). If the sum equals 1 (in the process) then the given number is happy otherwise it is an unhappy number (or sad number).

Program to test whether given number is a happy number or not



Developer: Abhishek Nandakumar
Licence: OpenSource
Platform/Language: java
Download


Popular posts from this blog

Two Level File Directory

Banker's Algorithm