Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class Startup
- {
- static void Main()
- {
- var readNumbers = Console.ReadLine();
- int[] arrayNumbers = readNumbers.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
- var stack = new Stack<int>(arrayNumbers);
- while (stack.Count != 0)
- {
- if (stack.Count != 0)
- {
- Console.Write($"{stack.Pop()} ");
- }
- else
- {
- Console.Write(stack.Pop());
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment