# Bike Gears

*This challenge is based on Q4 from ALevel Computing F452 Jan 2011 meaning it is representative of the sort of question you could be asked in the exam albeit at the upper end of the scale.*

### Introduction

The gears of a bicycle contain up to 9 sprockets with decreasing number of teeth. A computer program in a bicycle repair shop allows the user to input the number of teeth on each sprocket into an array called sprockets using the method described below:

- The user inputs the number of rings between 1 and 9;
- The user then inputs the number of teeth on each sprocket, starting with the smallest.
- The program checks that the number of teeth inputted is smaller than the previous number.
- The program stores the number of teeth on the first sprocket into the array sprockets as sprockets[0], the number of teeth on the second sprocket as sprockets[1], and so on.
- If there are fewer than 9 sprockets any unused elements of the array sprockets are set to 0.
- The program should output the sprocket sizes starting with the largest.

### Task 1

Produce either a flowchart or write a pseudo-code algorithm that describes the above process.

### Task 2

Produce the required program.

### Extension

Using the information found on the Wikipedia Bicycle Gear page can you improve your program so it calculates gear ratios and outputs them alongside the sprocket size.

#### Hints

- Start by calculating Gear Inches with a single front chain ring and a 700c road bike wheel with a diameter of 622mm using the equation below:
- Diameter of drive wheel in inches × (number of teeth in front chainring / number of teeth in rear sprocket)
- Improve your program so it can cope with multiple wheel sizes.
- Improve your program so it can deal with multiple front chain rings.