fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. static void Main(string[] args)
  7. {
  8. try
  9. {
  10. List<int> lst = new List<int>();
  11. int chk = -1;
  12. bool isProcess = false;
  13. y:
  14. if (!isProcess)
  15. {
  16. Console.Clear();
  17. Console.WriteLine("Please enter the numbers(Random numbers with <= 100,000). Type 'END' to process!");
  18. var line = Console.ReadLine();
  19.  
  20.  
  21. if (string.IsNullOrEmpty(line.ToString()))
  22. {
  23. Console.WriteLine("Please enter numaric value");
  24. goto y;
  25. }
  26. else
  27. {
  28. if (line.ToString().Trim().ToUpper().Equals("END")) isProcess = true;
  29. else
  30. {
  31. int.TryParse(line.ToString(), out chk);
  32. if (chk == 0)
  33. {
  34. Console.WriteLine("Please enter numaric value");
  35. goto y;
  36. }
  37. }
  38. }
  39. if (!isProcess) lst.Add(Convert.ToInt32(line));
  40. goto y;
  41. }
  42. else
  43. {
  44. lst.Sort();
  45. foreach (int n in lst)
  46. Console.WriteLine(n.ToString());
  47. Console.ReadKey();
  48. }
  49.  
  50.  
  51. }
  52. catch (Exception e)
  53. {
  54. Console.WriteLine(e.Message);
  55. Console.ReadKey();
  56. }
  57.  
  58. }
  59. }
Success #stdin #stdout 0.03s 24128KB
stdin
Standard input is empty
stdout
Please enter the numbers(Random numbers with <= 100,000). Type 'END' to process!
Object reference not set to an instance of an object