The two subroutines Figure 1 and Figure 2 are designed to calculate the sum of numbers from n n\,n down to 1.
SUBROUTINE sumValues(n)
total ← 0
WHILE n > 0
total ← total + n
n ← n - 1
ENDWHILE
OUTPUT total
ENDSUBROUTINE
SUBROUTINE sumValues(n)
total ← 0
REPEAT
total ← total + n
n ← n - 1
UNTIL n ≤ 0
OUTPUT total
ENDSUBROUTINE
Describe two differences in the way the loops in Figure 1 and Figure 2 operate.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.