Algorithm Planning and Design
Problem: Read in 10 numbers and display their total
Think about input - processing and storage - output.
We need to instruct the processor about a "Running Total"
We will start by setting the total to 0. We will set the count to zero. The count is how many numbers we have added.
Top Down Design Method
Total 10 numbers
Initialise values for running total Input and process 10 numbers* Display answer
| |
________ |
| | ___________________
Total=0 Count=0 | | |
Input a number add number to total add 1 to cart
*Process the numbers 10 times (repeat) enter a single number and add it to the running total.