Puzzle L26


Print a square of alternating stars and dots

[M-8]Write a main() program that prints an n x n square composed of alternating star and dot characters.

*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*
.*.*.*.*.*.*.*.*.
*.*.*.*.*.*.*.*.*

Write the program so that it works regardless of whether n is even or odd.



Previous Page        Answer         Next Page         Home