Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Triangle (right angle)
Time Limit: 2 sec
Memory Limit: 128000 kB
Problem Statement
In this task you need to print a right angle triangle of height 5.
Input
No input
Output
Print the right angle triangle of height 5 as shown.
Example
Sample Output:-
*
* *
* * *
* * * *
* * * * *

What I have tried:

Triangle (right angle)
Time Limit: 2 sec 
Memory Limit: 128000 kB
Problem Statement
In this task you need to print a right angle triangle of height 5.
Input
No input
Output
Print the right angle triangle of height 5 as shown.
Example
Sample Output:- 
* 
* * 
* * * 
* * * * 
* * * * *
Posted
Updated 29-Dec-22 18:51pm

1 solution

Think about it, each line has one more:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

This is a loop from 1 to 5, each line has 1 to 5 stars. I am sure you learned about for loops in class.

I have done your logic for you, now you need to write the code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900