Saturday 10 December 2011

Write a program to print a trangle in c

#include
#include
main()
{
int n,i,j;
clrscr();
printf("Enter How Many Lines You Want In This Figure:");
scanf("%d",&n);
for(i=0;i {
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}

OUTPUT
Enter How Many Lines You Want In This Figure:5
*
* *
* * *
* * * *
* * * * *

No comments:

Post a Comment