Parameters of Main, Sum Learn programming C# Sharp

Lesson:

Functions


Exercise:

Parameters of Main, Sum 14


Objetive:

Create a program named "sum", which receives two integer numbers in the command line and displays their sum, as in this example:

sum 5 3
8


Code:

using System;
public class exercise112
{
    public static void Main(string[] args)
    {
        if (args.Length == 2)
            Console.WriteLine(Convert.ToInt32(args[0]) +
                Convert.ToInt32(args[1]));
        else
            Console.WriteLine("Two numbers, please");
    }
}