Equivalent operations Learn programming with Visual Basic (VB.net) exercises


First contact with Visual Basic (VB.net)


Equivalent operations 101


Write a Visual Basic (VB.net) program to ask the user for three numbers (a, b, c) and display the result of (a+b)·c and the result of a·c + b·c.


Imports System
Public Class exercise10
    Public Shared Sub Main()
        Dim num1, num2, num3 As Integer
        Console.Write("Enter first number....")
        num1 = Convert.ToInt32(Console.ReadLine())
        Console.Write("Enter second number....")
        num2 = Convert.ToInt32(Console.ReadLine())
        Console.Write("Enter third number....")
        num3 = Convert.ToInt32(Console.ReadLine())
        Console.Write("Result of operation between {0}," & " {1} and {2}, (a+b)·c is {3} and a·b + a·c is {4}", num1, num2, num3, ((num1 + num2) * num3), (num1 * num3 + num2 * num3))
    End Sub
End Class