/**************************************************************************** * battleship.c * * Computer Science 50 * David J. Malan * * Prints a Battleship board. * * Demonstrates nested loop. ***************************************************************************/ #include int main(int argc, char * argv[]) { int i, j; /* print top row of numbers */ printf("\n "); for (i = 1; i <= 10; i++) printf("%d ", i); printf("\n"); /* print rows of holes, with letters in leftmost column */ for (i = 0; i < 10; i++) { printf("%c ", 'A' + i); for (j = 1; j <= 10; j++) printf("o "); printf("\n"); } printf("\n"); }