Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace AlgorithmsOverStructureData
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- Stack<int> stack = new Stack<int>();
- for (int number = 1; number <= n; number++)
- {
- int value = int.Parse(Console.ReadLine()); // 1 2 3 4
- stack.Push(value); // 4 3 2 1
- }
- while (stack.Count > 0)
- {
- Console.Write(stack.Pop() + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement