Question

C code Given numRows and numColumns, print a list of all seats in a theater. Rows...

C code

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:

1A 1B 1C 2A 2B 2C 

#include <stdio.h>

int main(void) {
int numRows;
int numColumns;
int currentRow;
int currentColumn;
char currentColumnLetter;

scanf("%d", &numRows);
scanf("%d", &numColumns);

/* Your solution goes here */

printf("\n");

return 0;
}

0 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1
#include 

int main(void) {
int numRows;
int numColumns;
int currentRow;
int currentColumn;
char currentColumnLetter;

scanf("%d", &numRows);
scanf("%d", &numColumns);

for(currentRow=1; currentRow<= numRows; currentRow++)
{
for(currentColumn=65; currentColumn <= 65 + numColumns -1; currentColumn++)
{
currentColumnLetter = currentColumn;
printf("%d%c ",currentRow,currentColumnLetter);
}
}

printf("\n");

return 0;
}

Add a comment
Know the answer?
Add Answer to:
C code Given numRows and numColumns, print a list of all seats in a theater. Rows...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • In Java; Given numRows and numColumns, print a list of all seats in a theater. Rows...

    In Java; 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. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C import java.util.Scanner; public class NestedLoops { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int...

  • Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered,...

    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: 1A 1B 1C 2A 2B 2C c++. #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; cin >> numRows; cin >> numColumns; cout << endl; return 0; }

  • C++ Given numRows and numColumns, print a list of all seats in a theater. Rows are...

    C++ 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: 1A 1B 1C 2A 2B 2C #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; cin >> numRows; cin >> numColumns; /* Your solution goes here */ cout...

  • (Java Zybooks) Given numRows and numColumns, print a list of all seats in a theater. Rows...

    (Java Zybooks) 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. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C import java.util.Scanner; public class NestedLoops { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int...

  • (Java Zybooks) 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. Use s...

    (Java Zybooks) 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. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C import java.util.Scanner; public class NestedLoops { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int...

  • Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number...

    Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any other spaces like spaces after the printed number. Ex: userNum = 3 prints: 0 1 2 3 Sample program: #include <stdio.h> int main(void) { int userNum = 0; int i =...

  • I have to write a C program to assign seats on each flight of the airline’s...

    I have to write a C program to assign seats on each flight of the airline’s only plane (capacity: 40 seats, in 10 rows). For the sake of simplicity, assume that each row has 4 seats labeled A, B, C, D. Your program should display the following menu of alternatives: Please type 1 for "first class" Please type 2 for "business class" Please type 3 for “economy class”. If the person types 1, then your program should assign a seat...

  • // C code // If you modify any of the given code, the return types, or...

    // C code // If you modify any of the given code, the return types, or the parameters, you risk getting compile error. // Yyou are not allowed to modify main (). // You can use string library functions. #include <stdio.h> #include <stdlib.h> #include <string.h> #pragma warning(disable: 4996) // for Visual Studio #define MAX_NAME 30 // global linked list 'list' contains the list of patients struct patientList {    struct patient *patient;    struct patientList *next; } *list = NULL;  ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT