Saturday, March 10, 2012

Program to print the pyramid of no.

//Program to print the  pyramid of no.
              1
          1  2  3 
       1 2  3  4  5
    1 2 3  4  5  6  7
#include<stdio.h>
#include<conio.h>
main()
{
      int x,y,i,g;
      y=1;
      for(x=3;x>=0;x--)
      {
      for(i=1;i<=x;i++)
       {printf("   ");
       }g=1;
       for(i=0;i<y;i++)
       {printf(" %d",g);g++;
       }
      
       y=y+2;
       printf("\n\n");
       }
       getch();
       }

No comments:

Post a Comment