Feb 24, 2007

C program to generate a pyramid of stars (upside down )

C program to generate pyramid of stars upside down using for loop.
#include<stdio.h>
main()
{
int a,b,c;
a=1;
clrscr();
for (a=5;a>=1;a--)
{
for (b=a;b>=1;b--)
{
printf("*");
}
printf("\n");
}
getch();
}
//output would be
*****
****
***
**
*

No comments:

Post a Comment