Ruby program for Happy and Unhappy(sad) Numbers

Description

As per Wiki, 

Happy Number – A happy number is a number defined by the following process: Starting with any positive integer, replace thenumber by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100..

Sad Number – An unhappy number is a number that is not happy, i.e., a number such that iterating this sum-of-squared-digits map starting with never reaches the number 1. The first few unhappy numbers are 2, 3, 4, 5, 6, 8, 9, 11, 12, 14, 15, 16, 17, 18…

Program

Output

Case 1

Enter the number:
10
Happy

Case 2

Enter the number:
18
Sad