Question: Need to modify this so that if numRows or columns is zero(0), it would not print anything to the screen. Right now the code will

Need to modify this so that if numRows or columns is zero(0), it would not print anything to the screen. Right now the code will print out:

1A 1B 1C 2A 2B 2C 3A 3B 3C 4A 4B 4C 5A 5B 5C -- which is not what I want..

I want to use an if statement such as if(i<=0 || j<=0).. but not too sure. Thanks for you help!

#include

int main(void) { int numRows = 2; int numCols = 3;

// Note: You'll need to declare more variables int i; char j; /* Your solution goes here */ for(i=1;i<=numRows;++i){ for(j='A';j<='C';++j) printf("%d%c ", i,j); }

printf(" ");

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!