Back to Challenge Set 11

Code Challenge: Times Table Poster

Difficulty  

divider

The Brief

What they asked for
The single times table was useful but my cousin needs the whole
set for the wall. All twelve of them, one after another, each
one headed so she can find the one she wants. Put a gap between
them or it is a wall of numbers.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • This is Times Table from Challenge Set 9 with a loop around it. If you did that one, start from it. If you did not, do the single table first and get it right before you wrap anything.
  • There is no input at all. The customer said twelve and said which twelve. Read the brief again if that surprises you.
  • Work out how many lines this prints before you run it. Then run it and check. Getting that number right is most of what this challenge is testing.
  • Two numbers are being multiplied and both of them are loop counters. Which one is which decides whether you get twelve tables or one table twelve times.
  • The heading and the gap are requirements, not decoration. Decide where each one goes — inside the outer loop, or outside it — and be able to say why.

Sample Output

Sample Output
--- 1 times table ---
1 x 1 = 1
2 x 1 = 2
...
12 x 1 = 12
--- 2 times table ---
1 x 2 = 2
2 x 2 = 4
...
12 x 2 = 24
--- 3 times table ---
...

Check the 7 table against the 7 you already know. If your 12 times table reads 1 x 12 = 12 through 12 x 12 = 144, the two counters are the right way round.


Submit

Your requirements list and your program file, named cc-table-poster.

Commence Challenge