Sunday, February 15, 2015

C Program to print following triangle


 *
**
***
****
*****


code:
#include<iostream.h>
#include<conio.h>


void main()
{
clrscr();
int n,i,j;
cout<<"Ener size of Triangle(ex-4):";
cin>>n;
cout<<"
";



for(i=0;i<n;++i)
{
for(j=0;j<=i;++j)
cout<<"*";
cout<<"
";

}
getch();
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.