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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started