Squares
A whole number n comes in on standard input. Print the squares of 1 up to n, one per line: 1, 4, 9 and so on.
Example 1
standard input
4
prints
1 4 9 16
Constraints
1 <= n <= 20
Write it in your browser, against the clock. The model script, with a note on each command it uses, comes after.
More Bash problems
- Sum a ColumnMedium
- Swap Two ColumnsMedium
- The Longest LineMedium
- The Most Common WordMedium
- Busiest VisitorsHard
- Lines of CodeHard
- Only in the FirstHard
- Share of ErrorsHard