Do While/Loop: multiplies and displays product while product is less than or equal to 1000 : Do While « Statements « VB.Net Tutorial






Module Tester

    Sub Main()
        Dim product As Integer = 2

        
        Do While product <= 1000
            Console.Write("{0}  ", product)
            product = product * 2
        Loop

        Console.WriteLine("Smallest power of 2 " & _
           "greater than 1000 is {0}", product)
    End Sub

End Module
2  4  8  16  32  64  128  256  512  Smallest power of 2 greater than 1000 is 1024








4.12.Do While
4.12.1.Do While Loop
4.12.2.Do While/Loop: multiplies and displays product while product is less than or equal to 1000
4.12.3.Exit Do While