Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PrintNumbersInReverseOrder
- {
- class Program
- {
- static void Main(string[] args)
- {
- int volume = int.Parse(Console.ReadLine());
- int[] num = new int [volume];
- for (int i = 0; i < volume; i++)
- {
- int number = int.Parse(Console.ReadLine());
- num[i] = number;
- }
- for (int i = num.Length - 1; i >= 0; i--)
- {
- Console.Write($"{num[i]} ");
- }
- }
- }
- }
- Решение с Join() и Reverse():
- using System;
- using System.Linq;
- namespace PrintNumbersInReverseOrder
- {
- class Program
- {
- static void Main(string[] args)
- {
- int volume = int.Parse(Console.ReadLine());
- int[] num = new int[volume];
- for (int i = 0; i < volume; i++)
- {
- num[i] = int.Parse(Console.ReadLine());
- }
- Console.WriteLine(string.Join(" ", num.Reverse()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement