1. You are given a number N.
2. You have to find whether N is "happy" or not.
3. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
For Example:
Input: 19
Output: Happy
Explanation:
1^2 + 9^2 = 82
8^2 + 2^2 = 68
6^2 + 8^2 = 100
1^2 + 0^2 + 0^2 = 1
4. main takes input N from the users.
5. This is a functional problem.
6. You have to complete the isHappy function. It takes as input the number N. It should return true if N is happy, else should return false.
7. Don't change the code of main.
Input Format
First line takes input N. Input is handled for you.
Output Format
Happy, if the number is a happy number, else Not Happy. Output is handled for you.
Constraints
N/A
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
19
Output
Happy