Saturday, March 10, 2012

Program to Print the pyramid.

//Print the pyramid like..
*********
  *******
   *****
     ***
       *
#include<stdio.h>
#include<conio.h>
main()
{
      int x,y,i;
      y=9;
      for(x=4;x>=0;x--)
      {
      for(i=4;i>x;i--)
       {printf(" ");
       }
       for(i=0;i<y;i++)
       {printf("*");
       }
      
       y=y-2;
       printf("\n");
       }
       getch();
       }

No comments:

Post a Comment