C program for character/alphabet pattern 18

C program for character/alphabet pattern 18

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

A
B B
C C C
D D D D
E E E E 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,j,k,n;
 
    printf("Enter till which value you want to print\n");
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n-i;j++)
        {
            printf(" ");
        }
        for(k=1;k<=i;k++)
        {
            printf("%c",(char)(i+64));
        }
        printf("\n");        
    }
}

Output

Share Me!