Write individual program to print the following Pyramids:-
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,n=40,m;
clrscr();
scanf("%d",&m);
printf("\n\n\n");
for(a=1;a<=m;a++)
{
for(b=1;b<=n;b++)
printf(" ");
for(b=1;b<=a;b++)
printf("%d ",b);
for(b=a-1;b>=1;b--)
printf("%d ",b);
printf("\n");
n=n-2;
}
n=n+4;
for(a=m;a>=1;a--)
{
for(b=1;b<=n;b++)
printf(" ");
for(b=1;b<=a-1;b++)
printf("%d ",b);
for(b=a-2;b>=1;b--)
printf("%d ",b);
printf("\n");
n=n+2;
}
getch();
}
#include<conio.h>
main()
{
int a,b,n=40,m;
clrscr();
scanf("%d",&m);
printf("\n\n\n");
for(a=1;a<=m;a++)
{
for(b=1;b<=n;b++)
printf(" ");
for(b=1;b<=a;b++)
printf("%d ",b);
for(b=a-1;b>=1;b--)
printf("%d ",b);
printf("\n");
n=n-2;
}
n=n+4;
for(a=m;a>=1;a--)
{
for(b=1;b<=n;b++)
printf(" ");
for(b=1;b<=a-1;b++)
printf("%d ",b);
for(b=a-2;b>=1;b--)
printf("%d ",b);
printf("\n");
n=n+2;
}
getch();
}