public static void Main()
char[] array = new char[] { };
Console.Write("Enter a number:");
input = Console.ReadLine();
array = input.ToCharArray();
if (Int32.TryParse(input, out number))
Console.WriteLine("\nZero and negative values is not allowed.");
while (input.Length != 1)
for (int i = 0; i < array.GetLength(0); i++)
values += (int)Math.Pow(Int32.Parse(array[i].ToString()), 2);
input = values.ToString();
array = input.ToCharArray();
Console.WriteLine("\n{0} is happy number.", number);
Console.WriteLine("\n{0} is not happy number.", number);
Console.WriteLine("\nThe number that input by the user exceeds the limit of the program\nThe program can only holds from 1 to 20,000");
Console.WriteLine("\nThe number that input by the user consist of non numerical value.");