Home >>VB.Net Built-in Functions >VB.Net program to print the table of given number using Do While

VB.Net program to print the table of given number using Do While

Write a VB.Net program to print the table of given number using Do While

Here, we can read a number from the user and use the Do Loop While loop on the console screen to print a table of the specified number.

Program :

The source code to print the table of given numbers using the Do Loop While loop is given below. The program given is successfully compiled and executed.

'VB.Net program to print the table of given number

'using "do loop while" loop.


Module Module1
    Sub Main()
        Dim count As Integer = 1
        Dim num As Integer = 0

        Console.Write("Enter number: ")
        num = Integer.Parse(Console.ReadLine())
        Do
            Console.Write("{0} ", num * count)
            count = count + 1
        Loop While (count <= 10)
        Console.WriteLine()
    End Sub   
End Module
	
Output:
Enter number: 8
8 16 24 32 40 48 56 64 72 80

Explanation:

We created a Module1 module in the above program that contains the function Main(). In the Main(), we created two variables count and num, which are initialized with 1, 0 respectively.

Console.Write("Enter number: ")
num = Integer.Parse(Console.ReadLine())
Do
    Console.Write("{0} ", num * count)
    count = count + 1
Loop While (count <= 10)