How the output get in the program to display a triangle of stars | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How the output get in the program to display a triangle of stars

13th Jun 2018, 3:49 PM
Beenu Thomas
3 Answers
+ 2
Easy task. Make a function such as printStar and declare a variable i as argument. Make a for loop inside the function with initial value of int j and j greater than i. Print "*". In the main function, make a for loop for printing the printStar function again and again. See this code, I have made. https://code.sololearn.com/cmBD6PvH52G0/?ref=app
13th Jun 2018, 4:02 PM
Akash Pal
Akash Pal - avatar
+ 2
I want to know the steps to get that output
13th Jun 2018, 4:21 PM
Beenu Thomas
+ 1
Beenu Thomas I have edited the code with comments. You can see it now.
13th Jun 2018, 4:27 PM
Akash Pal
Akash Pal - avatar