Question
im getting this error ... Your output 1A1B1C2A2B2C Expected output 1A 1B 1C 2A 2B 2C public class NestedLoops { public static void main (String
im getting this error ... Your output 1A1B1C2A2B2C Expected output 1A 1B 1C 2A 2B 2C
public class NestedLoops { public static void main (String [] args) { int numRows = 2; int numCols = 3;
// Note: You'll need to define more variables
int i, j;
char ch = 'A';
// Note: You'll need to declare more variables
/* Your solution goes here */
for ( i = 0; i < numRows ; i ++) { // Outer loop runs for numRows times
for ( j = 0; j < numCols ; j ++) { // Inner loop runs for numCols times
System.out.print(i+ 1);
System.out.print((char )(ch + j));
} } System.out.println("");
return; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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