Several operations Learn programming Visual Basic (VB.net)

Lesson:

First contact with Visual Basic (VB.net)


Exercise:

Several operations 19


Objetive:

Write a Visual Basic (VB.net) program to print on screen the result of adding, subtracting, multiplying and dividing two numbers typed by the user. The remainder of the division must be displayed, too.

It might look like this:
Enter a number: 12
Enter another number: 3
12 + 3 = 15
12 - 3 = 9
12 x 3 = 36
12 / 3 = 4 <
12 mod 3 = 0


Code:

Imports System
Public Class exercise7
    Public Shared Sub Main()
        Console.Write("Enter a number: ")
        Dim number1 As Integer = Convert.ToInt32(Console.ReadLine())
        Console.Write("Enter another number: ")
        Dim number2 As Integer = Convert.ToInt32(Console.ReadLine())
        Console.WriteLine("{0} + {1} = {2}", number1, number2, number1 + number2)
        Console.WriteLine("{0} - {1} = {2}", number1, number2, number1 - number2)
        Console.WriteLine("{0} x {1} = {2}", number1, number2, number1 * number2)
        Console.WriteLine("{0} / {1} = {2}", number1, number2, number1 / number2)
        Console.WriteLine("{0} mod {1} = {2}", number1, number2, number1 Mod number2)
    End Sub
End Class