1.5 Multiply, using variables

Objetive

Write a C# program to print the result of multiplying two numbers which will entered by the user. Compile it using Mono. Check that the resulting EXE file works properly.

Solution

public class MultiplyUsingVariables
{
    public static void Main()
    {
        int number1;
        int number2;
        int multiplication;

        System.Console.WriteLine("Enter 1st number");
        number1 = System.Convert.ToInt32(System.Console.ReadLine());
        System.Console.WriteLine("Enter 2nd number");
        number2 = System.Convert.ToInt32(System.Console.ReadLine());

        multiplication = number1 * number2;
        System.Console.WriteLine("The multiplication is:");
        System.Console.WriteLine(multiplication);
    }
}


Popular Posts