Exercise
Multiply using variables
Objetive
Write a Visual Basic (VB.Net) program to print the result of multiplying two numbers which will entered by the user.
Code
' Main class definition
Public Class Program
' Main subroutine, entry point of the program
Public Shared Sub Main()
' Prompt the user to enter the first number
Console.Write("Enter the first number: ")
Dim number1 As Integer = Convert.ToInt32(Console.ReadLine())
' Prompt the user to enter the second number
Console.Write("Enter the second number: ")
Dim number2 As Integer = Convert.ToInt32(Console.ReadLine())
' Perform multiplication and store the result
Dim result As Integer = number1 * number2
' Display the result on the screen
Console.WriteLine("The result of multiplying the two numbers is: " & result)
End Sub
End Class