42.6k views
2 votes
Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numColumns = 3 prints:

User Overbeeke
by
6.1k points

1 Answer

1 vote

Answer:

#include <stdio.h>

int main(void)

{

int Rows = 2;

int Col = 3;

int row = 0;

char colm = 'A';

char var = 'A';

for (row = 1; row<=Rows; ++row){

for (colm = 0; colm<Col; colm++){

printf("%d", row);

printf("%c ", var + colm % 3);

}

}

++var;

}

}

printf("\\");

return 0;

}

User Zerocog
by
6.2k points