Saturday, March 10, 2012

Program to Print the pyramid.

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

No comments:

Post a Comment