C program for the alphabet pattern "A, ABA, ABCBA, ABCDCBA,......"

#include<stdio.h>
#include<conio.h>
void main()
{
int i,x=0,n,k=1;
char j;
puts("Enter number of rows");
scanf("%d",&n);
while(x<n&&n<=26)
{
j='A';
for(i=0;i<(2*n-2);i++)
printf(" ");
for(i=0;i<k;i++)
printf("%c ",j++);
j--;
for(i=k;i>1;i--)
printf("%c ",--j);
printf("\n");
n--;
k++;
}
}

Output of this program :-

Comments