Parameters of Main, Reverse Learn programming C#

Lesson:

Functions


Exercise:

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


Code:

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

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.