New course! Every coder should learn Generative AI!
Try a free lesson+ 1
#problem
how to make a diamond type structure
4 Answers
+ 6
A diamond type structure basically has decreasing no. of spaces in and then increasing no. of a character you want. And then repeating the same thing in the reverse order (to form an inverted triangle)
For example: a diamond can be made as:
4spaces + one "*" (star)
3spaces + 2 stars
2spaces + 3 stars
1space + 4 stars
0spaces + 5 stars
This will form the 1st triangle. For the lower, inverted triangle:
1spaces + 4stars
2spaces + 3 stars
3space + 2 stars
4spaces + 1 stars
Now you can do this with loops in any language!
+ 2
thanks yash
+ 1
which structure specifically
+ 1
I don't understand