0% found this document useful (0 votes)
2 views2 pages

Iteratyion Programming

The document provides examples of iteration programming using 'For' and 'Repeat Until' loops in Visual Basic. It demonstrates how to calculate the sum and average of five user-input numbers. The code includes prompts for user input and displays the results at the end.

Uploaded by

chosenshoko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Iteratyion Programming

The document provides examples of iteration programming using 'For' and 'Repeat Until' loops in Visual Basic. It demonstrates how to calculate the sum and average of five user-input numbers. The code includes prompts for user input and displays the results at the end.

Uploaded by

chosenshoko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Iteratyion programming

For next loop

Dim average as double

Dim count,sum,number as integer

Sum = 0

Average = 0

For count = 1 to 5

Console.writeline(“Enter number “ & count)

Number = console.readline

Sum = sum + number

Next count

Average = sum/5

Console.writeline(“the sum of numbers is “ & sum)

Console.writelie()

Console.writeline(“the average of numbers is “ & average)

Console,writeline()

Console.readkey

Repeat until strcutures


Module Module1
'repeat until structure
Sub Main()
Dim average As Double
Dim count, sum, number As Integer
average = 0
sum = 0
count = 1
Do
Console.WriteLine("enter number " & count)
number = Console.ReadLine
sum = sum + number
count = count + 1
Loop Until count > 5
average = sum / 5
Console.WriteLine("the sum of the numbers is " & sum)
Console.WriteLine()
Console.WriteLine("the average of the numbers is " & average)
Console.ReadKey()
End Sub

End Module

You might also like