Puzzle L25


Print a square divided into bands four rows wide of 4 different chars

[M-12]Write a main() program that prints an n by n square of characters. Make the square out of bands that are 4 characters wide. Use four different characters for the bands, and keep repeating the bands until the square is finished. Here is the output when n==24:

************************
************************
************************
************************
........................
........................
........................
........................
oooooooooooooooooooooooo
oooooooooooooooooooooooo
oooooooooooooooooooooooo
oooooooooooooooooooooooo
++++++++++++++++++++++++
++++++++++++++++++++++++
++++++++++++++++++++++++
++++++++++++++++++++++++
************************
************************
************************
************************
........................
........................
........................
........................

If n is not a multiple of four, the last band will have fewer than four rows.



Previous Page        Answer         Next Page         Home