Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. namespace ReverseNumbersWithAStack
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string[] input = Console.ReadLine().Split(' ');
  10.  
  11. Stack<int> stack = new Stack<int>();
  12.  
  13. foreach (var item in input)
  14. {
  15. stack.Push(int.Parse(item));
  16. }
  17. while (stack.Count != 0)
  18. {
  19. Console.Write($"{stack.Pop()} ");
  20. }
  21. Console.WriteLine();
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement