How can the program in problem be modified to output the subtotal after each value is added instead of just the final result? Include messages in the OUTPUT statements to distinguish between the subtotal and the grand total. Check the program to insure that it works correctly.
Two changes (shown in bold below) are needed:
• Add a subtotal OUTPUT statement immediately below the accumulation statement
• Modify the final OUTPUT statement to include a "grand total" message.
```
LET sum = 0
LET n = 1
DO WHILE n < = 9
LET sum = sum + n OUTPUT "The subtotal is ", sum LETn=n+ 2
LOOP
OUTPUT "The grand total is ", sum
The output would look like this:
The subtotal is 1
The subtotal is 4
The subtotal is 9
The subtotal is 16
The subtotal is 25
The grand total is 25
```
You might also like to view...
A merge field displays in the main document in what manner?
A) Underlined B) Colored C) Italicized D) Within double angle brackets
If a change is made to a worksheet, you have to make the corresponding change to the connected chart
Indicate whether the statement is true or false.