30 days of code: Day 7

https://www.hackerrank.com/domains/tutorials/30-days-of-code

Sample Input

4
1 4 3 2

Sample Output

2 3 4 1
int n = Convert.ToInt32(Console.ReadLine());
string[] stringArray = new string[n];

string input = Console.ReadLine();
stringArray = input.Split(' ');

if (stringArray.Length != n)
{
    return;
}

Array.Reverse(stringArray);


for (int i = 0; i < stringArray.Length; i++)
{
    Console.Write(stringArray[i] + " ");
}

Leave a Reply

Your email address will not be published. Required fields are marked *