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
Get step-by-step solutions from verified subject matter experts
