hi,
is there any way to print triangle in c++ like this :
*
* *
* * *
* * * *
* * * * *
hi,
is there any way to print triangle in c++ like this :
*
* *
* * *
* * * *
* * * * *
hi,
try this program this will print the output in traingle of '*' from left to right.
do the same thing to print '*' traingle from right to left just inverse the loop.
Code:# include <iostream> #include <conio.h> int printStars (int f,int g,int h); int main () { printStars(f, g, h); return 0; } int printStars (int f,int g,int h) { int f, g, h; for (f=1; f<=5; f++) { for (h= 4; h >=0; h--) { cout<<" "; while (g=0) { for (g=1; g<=lines; g++) } { cout<<"* "; } } cout<<endl; }}
Bookmarks