Programming Course in C# ¡Free!

Multiply, using variables

 Saturday, January 26, 2013 published by Exercises C#
Proposed exercise

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.



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

System.Console.WriteLine("Enter firt number");
number1 = System.Convert.ToInt32(System.Console.ReadLine());
System.Console.WriteLine("Enter second number");
number2 = System.Convert.ToInt32(System.Console.ReadLine());

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