using flowchart The pseudocode for the accumulator loop is given below: Declare Integer counter Declare Integer total
Question:
using flowchart
The pseudocode for the accumulator loop is given below:
Declare Integer counter
Declare Integer total = 0
Declare Integer number
For counter = 1 to 5
Display "Enter a number: "
Input number
Set total = total + number
End For
Display "The total is total: ", total
Step 3:
Click the Loop symbol and add it between the Start and the End symbol. Above the Loop symbol, add three assignment statements. Set a variable named counter to 1, a variable called total to 0, and a variable named number to 0.
Step 4:
Double-click the Diamond symbol and add the condition that will execute the loop through 5 iterations.
Step 5:
Add an input statement if the loop is NO. This statement will ask the user to enter a number.
Step 6:
Add an assignment statement that will accumulate the total, such as total = total + number.
Step 7:
Add an assignment statement that will increment the counter variable by 1.
Step 8:
Add an output statement outside of the loop if the condition is YES. This should display the total.
Step 9:
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill