← Unit 2 · all exercises
Saved in this browser only

A multiplication grid

Print an n by n multiplication grid. Each row holds the products separated by a single space, so n = 3 starts with the line "1 2 3". Do not leave a space at the end of a line.

void grid(int n)

Solution.java
Loading editor…
Results

Examples

  • grid(3) → 1 2 3 2 4 6 3 6 9
  • grid(1) → 1

There are also 2 hidden tests you can't see. Solve the problem, not the examples.