How to print triangle in c++ like this :
*
* *
* * *
* * * *
* * * * *
How to print triangle in c++ like this :
*
* *
* * *
* * * *
* * * * *
Last edited by Millerjames; 02-06-2010 at 03:53 PM.
Try to understand following code which is given below.
# include <iostream>
#include <conio.h>
int printStars (int a,int b,int c);
int main ()
{
printStars(a, b, c);
return 0;
}
int printStars (int a,int b,int c)
{
int a, b, c;
for (a=1; a<=5; a++)
{
for (c= 4; h >=0; c--)
{
cout<<" ";
while (b=0)
{
for (b=1; b<=lines; b++)
}
{
cout<<"* ";
}
}
cout<<endl;
}}
Bookmarks