#include <stdio.h> #include <stdlib.h> /* Puzzle A24 -- print a square divided into 8 horizontal bands of alternating * and . */ int main(int argc, char *argv[]) { int row, col; int boardsize=16, bandsize=boardsize/8; for ( row=0; row<boardsize; row++ ) { for ( col=0; col<boardsize; col++ ) { if ( (row/bandsize)%2 == 0) printf("*"); else printf("."); } printf("\n"); } printf("\n"); system("PAUSE"); return 0; }