Programming Course in C# ¡Free!

Parameters of Main, Reverse

 Saturday, April 06, 2013 published by Exercises C#
Proposed exercise

Create a program named "reverse", which receives several words in the command line and displays them in reverse order, as in this example:

reverse one two three
three two one

Output



Solution


using System;
public class ParamsOfMain
{
public static void Main()
{
for (int i = args.Length - 1; i >= 0 ; i--)
{
Console.Write( args[i] );
Console.Write( " " );
}
}
}