Exercise
Product
Objetive
Create a Visual Basic (VB.Net) program that asks the user for two integer numbers and shows their multiplication, but not using "*". It should use consecutive additions. (Hint: remember that 3 * 5 = 3 + 3 + 3 + 3 + 3 = 15)
Code
Imports System
Public Class exercis40
Public Shared Sub Main()
Console.Write("Enter the first number: ")
Dim n1 As Integer = Convert.ToInt32(Console.ReadLine())
Console.Write("Enter the second number: ")
Dim n2 As Integer = Convert.ToInt32(Console.ReadLine())
Dim result As Integer = 0
Dim i As Integer = 0
While i < n2
result = result + n1
i += 1
End While
Console.WriteLine("{0} X {1} = {2}", n1, n2, result)
End Sub
End Class