Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions