Isosceles triangle | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Isosceles triangle

How do I draw the Isosceles triangle with *

24th Apr 2019, 11:24 AM
Maryam Sadaghyani
Maryam Sadaghyani - avatar
2 Answers
+ 15
● basic way to make isosceles triangle is by using 3 loops(1 outer and 2 inner), giving initial space in each iteration of outer loop(getting reduced 1 in each iteration) & printing (2n-1) number of stars in each iteration of outer loop(n from 1 to size), in short, printing a row in each iteration of outer loop //1 inner loop for initial space in beginning of each row & another 1 for number of stars in each row ● example, here size is 4 , take _ as a space " " _____* ____*** ___***** __******* _********* /* note: number of loops can be reduced by simple noticing of pattern & by selecting different language too. pattern made assuming the Isoscles traingle to be filled from inside, to make hollow isosceles triangle use similiar logic with little modification. */
24th Apr 2019, 12:17 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
would u give me this code plz?
1st May 2019, 12:03 PM
Maryam Sadaghyani
Maryam Sadaghyani - avatar