/*Printing a double pyramid*/

#include
#include
void main(void)
{
clrscr();
int i,j,k,l,b,n;
printf("Enter the value of N:");
scanf("%d",&n);
for(i=0;i<n;i++) {="" printf("");="" for(l="0;l<i;l++)" printf("="" ");="" for(j="i+1;j<=n;j++)" printf("%d",j);="" for(k="n-1;k">i;k--)
printf("%d",k);
}
b=n-1;
for(i=0;i<n-1;i++) {="" printf("");="" for(l="n-2;l">i;l--)
printf(" ");
for(j=b;j<=n;j++)
printf("%d",j);
for(k=n-1;k>=b;k--)
printf("%d",k);
b--;
}
getch();
}

Leave a Reply

Leave a Reply

Your email address will not be published.