Using counter-controlled repetition : While « Statements « VB.Net Tutorial






Module modAverage

    Sub Main()
        Dim total As Integer         
        Dim gradeCounter As Integer  
        Dim grade As Integer         
        Dim average As Double        

        total = 0                    
        gradeCounter = 1             

        While gradeCounter <= 10
            grade = 12

            total += grade    

            gradeCounter += 1 
        End While

        average = total / 10

        Console.WriteLine("Class average is {0}", average)

    End Sub 

End Module
Class average is 12








4.8.While
4.8.1.While structure
4.8.2.Using counter-controlled repetition
4.8.3.Draw square of * by using nested while loop
4.8.4.Combine While and If to search in an array