Advertisement
Tanina80

stack

Jul 28th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _1
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int n = 5;
  11. Stack<int> stack = new Stack<int>();
  12.  
  13. for (int i = 0; i < n; i++)
  14. {
  15. int x = int.Parse(Console.ReadLine());
  16. stack.Push(x);
  17. }
  18.  
  19. while (stack.Count > 0)
  20. {
  21. int y = stack.Pop();
  22. Console.Write(y);
  23.  
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement