# Control Flow & Loops

## Exam Questions

Exam questions on this topic

## Task #1: Outputting multiples of 3

Write a suitable program which outputs all the multiples of 3 up to 50 to the console. Use either a while or for loop.

Reset to Original Code     Fullscreen

A hamster starts at the coordinate (0,0) and moves around in the following fashion:

## Task #4: Outputting prime numbers

Write a suitable program which outputs all the prime numbers between 1 and 300. You will need a way to determine whether each number you consider is prime.

Reset to Original Code     Fullscreen

## Challenge: Highest Common Factor

The Euclidean Algorithm is a well known technique to find the Higher Common Factor of two numbers. For two numbers x and y:

1. If x is 0 then stop and output y, and vice versa.
2. Find the remainder when x is divided by y. For examlpe, when 30 is divided by 4, the quotient is 7 and the remainder is 2.
3. Make x equal to y and y equal to this remainder, then go back to Step 1.
Reset to Original Code     Fullscreen