![]() |
VOOZH | about |
Here, we will see how to print a triangle using the C program
Input:
5
Output:
* * * * * * * * * * * * * * *
The approach is very simple. We just execute a nested loop, and only print characters when the inner loop is executed after that just change the line.
Example:
* ** *** **** ***** ******
Time Complexity: O(n2)
Auxiliary Space: O(1), No extra Space is used.