Question: Figure 12-20 earlier in this chapter shows the output of a program that displays any number of Os running diagonally from top left to bottom

Figure 12-20 earlier in this chapter shows the output of a program that displays any number of Os running diagonally from top left to bottom right. Now, write a program that prompts the user for a number of lines to display, and then use a recursive method to display Os from top right to bottom left. Figure 12-25 shows a sample execution. Save the program as OppositeDiagonal.java.


Data from in  Figure 12-20

Figure 12-20 Two typical executions of the Diagonalos program How many lines


Data from in  Figure 12-25

to display? >> 5 0 0 0 0 0 How many lines

Figure 12-20 Two typical executions of the Diagonalos program How many lines to display? >> 5 0 0 0 0 0 How many lines to display? >> 8 0 0 0 0 0 0 0 0

Step by Step Solution

3.52 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class Opposite Diagonal public static void mai... View full answer

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 Java Programming Questions!