You could make 10 copies the statements:
' Ask the user for 10 numbers. ' Add them up, print the sum. ' LET SUM = 0 ' Clear the sum ' PRINT "Enter a number" INPUT NUMBER LET SUM = SUM + NUMBER ' . . . . 9 more copies of the above group . . . . ' END
But this would be too much work.
Better, put the statements into a loop body,
and execute the loop 10 times.
Here is the LOOP
ing part of the program:
' Ask the user for 10 numbers. ' Add them up, print the sum. ' LET COUNT = 1 DO WHILE COUNT <= 10 . . . . loop body goes here . . . . LET COUNT = COUNT + 1 LOOP ' END
Here is the statement that starts SUM out at zero (like clearing a calculator before you use it):
LET SUM = 0
Here are the statements that get a number from the user and adds it to the sum:
PRINT "Enter a number" INPUT NUMBER LET SUM = SUM + NUMBER
Here is the statement that writes out the answer:
PRINT "The sum is", SUM
Mentally paste these statements into their correct locations in the above program.