Write a program that prints “spirals” of size , as it is shown in the examples.
Input consists of a sequence of strictly positive natural numbers, ended with zero.
For each
,
print a spiral of size
.
Note that in the bottom row and in the right column there are only
‘X’s. Print an empty line after each spiral.
A matrix is not needed to solve this problem, but use it for simplicity.
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T11:13:52.987Z
© Jutge.org, 2006–2026.
https://jutge.org