Solid Rhombus Pattern
May 25, 2023
ALGORITHM:
- Get the input for the number of rows
n
. - Initialize two loops for rows and columns.
- Repeat the outer loop until
i
reachesn
. - Inside the outer loop, initialize
j
asn - i
. - Repeat the inner loop until
j
is less thann
. - Inside the inner loop, print two spaces (“ “) to create the indentation for each row.
- Repeat the inner loop until
j
reachesn
. - Inside the inner loop, print an asterisk (“*”) to create the rhombus shape.
- Move to the next line by creating a newline character.
- Increment
j
by 1. - Increment
i
by 1. - Repeat the outer loop until all rows are printed.
FLOWCHART: