Quelpr

CAPE Computer Science Unit 1 · 2012 · Paper 2 · Question 3(d)

Write an algorithm that uses iteration to find the sum of all multiples of 4 and all multiples of 7 between m (inclusive) and n (inclusive) where m and n are two positive integers entered via the keyboard, assuming n > m.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 3(a)Explain the role of an algorithm in the problem-solving process.[2 marks]
  2. 3(b)(i)Which of the algorithms illustrates bounded iteration? Justify your answer.[3 marks]
  3. 3(b)(ii)Which of the algorithms illustrates unbounded iteration? Justify your answer.[3 marks]
  4. 3(c)(i)Write an algorithm to find and print the number of students that voted for EACH of the colours: red, blue, green.[5 marks]
  5. 3(c)(ii)Write an algorithm to find and print the TOTAL number of students that voted for red, blue or green.[5 marks]

More practice: the rest of this paper · more Algorithm Verification and Development questions · all CAPE Computer Science Unit 1 past papers