Question: Question 2 options: Answer three questions and complete the code: This program reads in a number R and a number C from the user, System.out.print(Enter

Question 2 options:

Answer three questions and complete the code:

This program reads in a number R and a number C from the user,

System.out.print("Enter Row: "); int R = kb.nextInt(); System.out.print("Enter Column: "); int C = kb.nextInt(); int k, x; if(R>C) R=C; k = ?; // Q1? for(int i = 0; i<=R-2; i++){ for(int j = 1; j<=k; j++) System.out.print("$"); for(int j = 1; j<=?; j++) // Q2 <=? System.out.print(" "); for(int j = 1; j<=k; j++) System.out.print("$"); System.out.println(); k = ?; // Q3 } for(int i = 0; i<2*C-1; i++) System.out.print("$"); System.out.println(); // last line

and displays a figure with R-rows and (2*C-1)-columns of "$" characters as the following pattern. For instance, if the user enters a 4 for R, and 6 for C, your program should display:

$$$ $$$ $$$$ $$$$ $$$$$ $$$$$ $$$$$$$$$$$

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!