bogdanalov

Untitled

May 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. class Startup
  7. {
  8. static void Main()
  9. {
  10. var readNumbers = Console.ReadLine();
  11. int[] arrayNumbers = readNumbers.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
  12. var stack = new Stack<int>(arrayNumbers);
  13.  
  14. while (stack.Count != 0)
  15. {
  16. if (stack.Count != 0)
  17. {
  18. Console.Write($"{stack.Pop()} ");
  19. }
  20. else
  21. {
  22. Console.Write(stack.Pop());
  23. }
  24.  
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment