Equivalent operations Learn programming Visual Basic (VB.net)


First contact with Visual Basic (VB.net)


Equivalent operations


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

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.