static void Main(string[] args) { while (true) { try { Armstrong number = new Armstrong(); number.FindingArmstrong(); Console.WriteLine("\nDo you want to continue? y/n"); string input = Console.ReadLine(); if (input == "y") { number.FindingArmstrong(); } else { break; } } catch (Exception exception) { Console.WriteLine(exception.Message); Console.WriteLine("Enter Valid Inputs."); } } }
static void Main(string[] args) { int number; int ch = 1; while (ch == 1) { Console.WriteLine("Hi! Please Enter Number"); number = Int32.Parse(Console.ReadLine()); Armstrong A = new Armstrong(number); Console.WriteLine("Press 1 to continue"); ch = Int32.Parse(Console.ReadLine()); } Console.Read(); }