#include <stdio.h> #include <stdlib.h> /* Puzzle A28 -- print a square with an 8 char wide diagonal band */ const int boardsize=16, bandsize=8 ; int main(int argc, char *argv[]) { int row, col; for ( row=0; row<boardsize; row++ ) { for ( col=0; col<boardsize; col++ ) { if ( row-bandsize/2 <= col && col < row-bandsize/2+bandsize ) printf("*"); else printf("."); } printf("\n"); } printf("\n"); system("PAUSE"); return 0; }