5.19 - Parameters of Main, Reverse

Objetive

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


Solution

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

Popular Posts