szymski

Untitled

Mar 19th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Rextester
  6. {
  7. public class Program
  8. {
  9. public static void Main(string[] args)
  10. {
  11. List<int> numbers = new List<int>();//deklaracja i inicjalizacja pustej listy
  12.  
  13. while (true)
  14. {
  15. int number = Convert.ToInt32(Console.ReadLine());
  16.  
  17. if (number == -1)
  18. {
  19. foreach (var num in numbers.OrderByDescending(a => a))
  20. Console.WriteLine(num);
  21.  
  22. Console.ReadLine();
  23.  
  24. return;
  25. }
  26. else
  27. numbers.Add(number);
  28. }
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment