C program for character/alphabet pattern 19

C program for character/alphabet pattern 19

This program is to print a character/alphabet pattern 19 in C.

A
B A B
C B A B C
D C B A B C D
E D C B A B C D E

If you need a dry run of the program or any other query, then kindly leave a comment in the comment box or mail me, I would be more than happy to help you.

Program

#include<stdio.h>

void main()
{
        int i,n,j;
        
        printf("Enter the no of lines\n");
        scanf("%d",&n);
        
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n-i;j++)
            {
                printf("  ");
            }
            for(j=i;j>0;j--)
            {
                printf(" %c",(char)(j+64));
            }
            for(j=2;j<=i;j++)
            {
                printf(" %c",(char)(j+64));
            }
            printf("\n");
        }
}

Output

Share Me!