Ejercicio
Repetir hasta 0 (Usa Do while)
Objetivo
Cree un programa en Visual Basic para pedir al usuario un número "x" y mostrar 10*x. Debe repetirse hasta que el usuario ingrese 0 (usando "do-while").
Código
' Import the System namespace to use Console class
Imports System
Public Class Program
' Main subroutine, entry point of the program
Public Shared Sub Main()
' Declare a variable to store the number entered by the user
Dim x As Integer
' Start a do-while loop that will repeat until the user enters 0
Do
' Ask the user to input a number
Console.Write("Enter a number (0 to stop): ")
' Read the user's input and convert it to an integer
x = Convert.ToInt32(Console.ReadLine())
' Display the result of 10 * x
If x <> 0 Then
Console.WriteLine("10 * " & x & " = " & (10 * x))
End If
Loop While x <> 0 ' The loop continues as long as x is not 0
End Sub
End Class