Professional Documents
Culture Documents
Unit 8 Assignments and Research
Unit 8 Assignments and Research
Unit 8 Assignments and Research
Algorithm Workbench
3.
for I = 0 to 1000 step 10
Print i
4.
Declare Integer product
Declare Integer number
Product = 0
Do While product < 100
Display Enter a number
Input Number
Product = product + number * 10
Loop
Chris trimble
Display Product
9.
Declare Integer count
For(count = 0; count <50; count ++)
Display The count is, count
10.
Declare Integer count
Count = 1
While count <= 50
Display count
Count = count + 1
End While
Programming Exercises
7.
Module main()
Local variables
Declare Realnumber of years, RealTotal rainfall
Get number of years, total rainfall
Call getNumber of years(number 0f years, total rainfall)
Calculate the number of years, total rainfall
Callset total(number of years, total rainfall
Call show total(number of years, total rainfall)
End Module
Module getNumber(Real Ref Input number of years)
Chris trimble
Chris trimble
Chris trimble
Display when finished, enter -99 to display the highest and lowest number
entered.
//Get input
If number ! = -99 Then
Display Enter your number:
Input number
If number > highNumber Then
highNumber = number
Else lowNumber = number
End If
Display The high number is: , highNumber
Display The low number is: , lowNumber
Display Thank you for your time!
End Main
Research
Count Controlledone set variable to an initial value, Two a test must be done
before entering the loop, Three the variable must also be incremented each time the
loop body is executed.
Condition Controlled Loopsthe loop is controlled by a specific condition. The
loop will continue to run as long as the condition is fulfilled. So it uses a true/false
condition to control the number of times that it will repeat.