Question: Introduction to Java programming Using a for() loop, write a program that accepts an integer value between 2-thru-9 (inclusive), and prints out a diamond for
Introduction to Java programming
Using a for() loop, write a program that accepts an integer value between 2-thru-9 (inclusive), and prints out a diamond for the number
Example: For the number 4, the output will be
1
222
33333
4444444
33333
222
1
Algorithm hints:
1. The number of characters to print for any number is (# * 2) 1
2. The number of leading spaces for any number is the difference between the number being printed, and the number that was input (e.g., 4 3 = 1, 4 2 = 2, etc)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
