Question: (JAVA) (See page 180 #3) Write a program that prompts the user for input to produce the output similar to what is shown below, if

(JAVA)

(See page 180 #3) Write a program that prompts the user for input to produce the output similar to what is shown below, if user input is 3. This diamond pattern is achieved through nested loop concept. There is no need to use any advanced techniques other than what we covered in class. Extra credit for people that complete one version with a nested for-loop and a second version with nested while-loop.

3

*

***

*****

***

*

Hint: Consider taking care of the space before you print the stars aligned as shown. Your program should be able to accept an integer n, then prints the picture of a diamond with 2 n ? 1 rows.

1 X

2 XXX

3 XXXXX

n XXX X (2 n _ 1 times)

XXXXX

XXX

2 n - 1 X

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!