Practice

Flowchart to Pseudocode: Sum Until Zero

MEDIUMFlowcharts

The flowchart below adds up numbers until 0 is entered, then outputs the total.

Write the pseudocode for this flowchart. Use the loop the flowchart shows: the decision comes before the loop body.

Sample Test Cases

Test 1: Two numbers
Inputs: 4, 6, 0
Expected: 10
Test 2: Zero straight away
Inputs: 0
Expected: 0