C program to print PYRAMID of stars
main()
{
int i,j,n,space;
clrscr();
printf("Enter the number of rows to be in Pyramid of stars:");
scanf("%d",&n);
space=n;
for(i=1;i<=n;i++)
{
for(j=1;j<space;j++)
printf(" ");
for(j=1;j<=2*i-1;j++)
printf("*");
printf("\n");
}
getch();
No comments:
Post a Comment