#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,j;
char ch;
clrscr();
printf("\n Please Give The Value of N: ");
scanf("%d",&n);
if(n>20)
{
printf("\n N MUST BE LESS THAN OR EQUAL TO 20 ");
printf("\n OTHERWISE IT IS NOT DISPLAY AS PYRAMID");
printf(" OR NOT FIT IN ");
}
else
{
for(i=1;i<=n;i++)
{
if(ch==90)
ch=65;
for(j=1;j<=n-i;j++)
printf(" ");
for(j=1,ch=87;j<=i;j++,ch++)
{
if(ch==91)
ch=65;
printf(" %c ",ch);
}
printf("\n");
}
}
getch();
}
--------------------------------- OUTPUT ---------------------------------
Please Give The Value of N: 9
W
W X
W X Y
W X Y Z
W X Y Z A
W X Y Z A B
W X Y Z A B C
W X Y Z A B C D
W X Y Z A B C D E