Advertisement
Guest User

Second Highest Number

a guest
Dec 7th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. Console.WriteLine("Insert 10 numbers");
  4. Console.WriteLine("=====================");
  5. string x = Console.ReadLine();
  6. string[] split = x.Split(new char[] { ' ' });
  7. if (split.Length < 9)
  8. {
  9. Console.WriteLine("Please insert 10 numbers");
  10. Console.WriteLine("=====================");
  11. x = Console.ReadLine();
  12. split = x.Split(new char[] { ' ' });
  13. }
  14.  
  15. Console.WriteLine("Second highest number: ");
  16. Console.WriteLine("=====================");
  17. Array.Sort(split);
  18. Console.WriteLine(split[split.Length - 1]);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement