Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

im getting this error ... Your output 1A1B1C2A2B2C Expected output 1A 1B 1C 2A 2

ID: 3909621 • Letter: I

Question

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;
}
}

Explanation / Answer

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