C program for character/alphabet pattern 17

C program for character/alphabet pattern 17

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

A
B F
C G J
D H K M
E I L N O

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,j,diff,value,n;
 
    printf("Enter the no of lines\n");
    scanf("%d",&n);
 
    for(i=1;i<=n;i++)
    {
        diff=n-1;
        value=i; 
        for(j=1; j<=i; j++)
        {
            printf("%4c",(char)(value+64));
 
            value=value+diff; 
            diff--;
        }
        printf("\n");
    }
}

Output

Share Me!