#problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

#problem

how to make a diamond type structure

27th Jul 2018, 9:49 AM
sanket charanpahadi
sanket charanpahadi - avatar
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!
27th Jul 2018, 1:26 PM
Yash✳️
Yash✳️ - avatar
+ 2
thanks yash
27th Jul 2018, 1:27 PM
sanket charanpahadi
sanket charanpahadi - avatar
+ 1
which structure specifically
27th Jul 2018, 11:40 AM
hinanawi
hinanawi - avatar
+ 1
I don't understand
27th Jul 2018, 11:56 AM
sanket charanpahadi
sanket charanpahadi - avatar