Home >>VB.Net Programs >VB.Net program to read a name and print 5 times using GoTo statement

VB.Net program to read a name and print 5 times using GoTo statement

Write a VB.Net program to read a name and print 5 times using GoTo statement

Here, we'll read a user string and print the entered name on the console screen 5 times.

Program :

Below is the source code to read and print a name 5 times using the 'GoTo' statement. The program given is compiled and successfully executed.

Example


Module Module1
    Sub Main()
        Dim name As String
        Dim count As Integer = 0
        Console.Write("Enter Name : ")
        name = Console.ReadLine()
MyLabel:
        count = count + 1
        If count <= 5 Then
            Console.WriteLine("Name : {0}", name)
            GoTo MyLabel
        End If
    End Sub
End Module
	
Output:
Enter Name : Test
Name : Test
Name : Test
Name : Test
Name : Test
Name : Test

Explanation:

We created a Module1 module in the program above that contains the Main() method. We created the name and count of three variables in the Main() method. Then we developed the MyLabel label, which is used using the "GoTo" statement to pass program control.

After that, we read the user's name and then printed the given name on the console screen 5 times.


VB.Net Programs Program to Print Hello World in VB.NET VB.Net program to demonstrate the difference between Console.Write() and Console.WriteLine() methods VB.Net program to print backslash (\) character on the console screen VB.Net program to convert a double number into an integer number VB.Net program to convert different types of variables into the string VB.Net program to demonstrate the use of the 'vbTab' constant VB.Net program to demonstrate the use of the 'vbCrLf' constant VB.Net program to input and print an integer variable VB.Net program to demonstrate the bitwise operators VB.Net program to print the binary number of a decimal number VB.Net program to print the total bits required to store a given integer number VB.Net program to count the total number of high bits in a given integer number VB.Net program to demonstrate the left-shift operator (<<) VB.Net program to demonstrate the right-shift operator (>>) VB.Net Program to perform BITWISE AND operation VB.Net program to perform BITWISE OR operation VB.Net program to perform BITWISE XOR operation VB.Net program to demonstrate the BITWISE NOT operator VB.Net program to perform the LOGICAL AND operation using the AndAlso operator VB.Net program to perform the LOGICAL OR operation using the OrElse operator VB.Net program to check the palindrome of the binary number using bitwise operators VB.Net program to check the given number is even or odd VB.Net program to check EVEN/ODD using bitwise operators VB.Net program to swap two numbers using a BITWISE XOR operator VB.Net program to check Nth bit of an integer number is SET or not VB.Net program to check the given number is EVEN or ODD using conditional operator VB.Net program to find the largest number between two numbers VB.Net program to find the largest number among three numbers VB.Net program to check the given number is POSITIVE or NEGATIVE VB.Net program to check leap year VB.Net program to check the given year is leap year or not using conditional operator VB.Net program to calculate the area of the circle VB.Net program to calculate the perimeter of the circle VB.Net program to calculate the area of the rectangle VB.Net program to calculate the Highest Common Factor (HCF) VB.Net program to calculate the multiplication of two numbers using the '+' operator VB.Net program to round off the value of the floating-point number VB.Net program to get a large value using Math.Max() method VB.Net program to get the smallest value using Math.Min() method VB.Net program to produce the full product of two 32-bit integer numbers VB.Net program to truncate the value of the floating-point number VB.Net program to find the angle for specified sine value VB.Net program to find the angle for specified cosine value VB.Net program to find the angle for specified tangent value VB.Net program to find the sine value for the specified angle VB.Net program to find the cosine value for the specified angle VB.Net Program to find the tangent value for the specified angle VB.Net program to find the hyperbolic sine VB.Net program to find the hyperbolic cosine VB.Net program to find the hyperbolic tangent VB.Net Program to demonstrate the Math.DivRem() method VB.Net program to demonstrate the Math.Exp() method VB.Net program to demonstrate the use of Math.IEEERemainder() method VB.Net program to find the logarithm value of a specified number VB.Net program to demonstrate the Math.Log10() method VB.Net program to find the sign of a specified number using Math.Sign() method VB.Net program to find the division of a student based on a given percentage VB.Net program to compare two strings VB.Net program to demonstrate the use of 'select case' VB.Net program to demonstrate the use of 'select case' with a given range VB.Net program to use a comma ',' to use multiple options in 'select case' VB.Net program to demonstrate the nested 'select case' VB.Net program to demonstrate the duplicate case in the 'select case' VB.Net program to create a simple calculator using 'select case' VB.Net program to print the table of given number using GoTo statement VB.Net program to print the ASCII values of numbers VB.Net program to print the HEX values of numbers VB.Net program to print 1, 11, 31, 61, ..., 10 times using GoTo statement VB.Net program to read a name and print 5 times using GoTo statement VB.Net program to print the square of numbers from 1 to 5