Skip to content

Loops · routine

A times table

Read a number n and print an n by n multiplication table: row i holds i*1, i*2, … i*n, separated by single spaces.

For 3 the output is three lines: 1 2 3, 2 4 6, 3 6 9.

Stuck on the idea rather than the code? The Stopping early, and loops in loops lesson walks through it.