using System; using System.Collections.Generic; public class Test { static void Main(string[] args) { try { List lst = new List(); int chk = -1; bool isProcess = false; y: if (!isProcess) { Console.Clear(); Console.WriteLine("Please enter the numbers(Random numbers with <= 100,000). Type 'END' to process!"); var line = Console.ReadLine(); if (string.IsNullOrEmpty(line.ToString())) { Console.WriteLine("Please enter numaric value"); goto y; } else { if (line.ToString().Trim().ToUpper().Equals("END")) isProcess = true; else { int.TryParse(line.ToString(), out chk); if (chk == 0) { Console.WriteLine("Please enter numaric value"); goto y; } } } if (!isProcess) lst.Add(Convert.ToInt32(line)); goto y; } else { lst.Sort(); foreach (int n in lst) Console.WriteLine(n.ToString()); Console.ReadKey(); } } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); } } }