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