Ejercicio
Tabla de multiplicación (usa while)
Objetivo
Escriba un programa en Visual Basic para pedir al usuario un número y mostrar su tabla de multiplicar, utilizando una instrucción "while".
Código
' Importing necessary namespaces
Imports System
Public Class Program
Public Shared Sub Main()
' Declare a variable for the number
Console.Write("Enter a number: ")
Dim number As Integer = Convert.ToInt32(Console.ReadLine()) ' Read the number from the user
' Declare a variable to track the multiplier
Dim multiplier As Integer = 1
' Loop to display the multiplication table
While multiplier <= 10
' Display the result of the multiplication
Console.WriteLine("{0} x {1} = {2}", number, multiplier, number * multiplier)
multiplier += 1 ' Increment the multiplier for the next iteration
End While
End Sub
End Class