ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

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

Here, we are going to learn how to print the table of given number using Do Loop While in VB.Net?
Submitted by Nidhi, on December 06, 2020

Here, we will read a number from the user and print the table of the given number using the Do Loop While loop on the console screen.

Program/Source Code:

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

'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
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a 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)

In the above code, we read an integer number from the user and then print the table of the given number using the Do Loop While loop on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.