← Unit 2 · all exercises
Saved in this browser only

A square of stars

Print an n by n square of stars, one row per line.

void square(int n)

Solution.java
Loading editor…
Results

Examples

  • square(3) → *** *** ***
  • square(1) → *

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