C program for character/alphabet pattern 16

C program for character/alphabet pattern 16

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

A
B C
D E F
G H I J
K L M 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,k=1,n;

    printf("Enter the no of lines\n");
    scanf("%d",&n);

    printf("Floyd's Triangle using alphabets/characters\n");
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=i;j++,k++)
        {
            printf("%4c",(char)(k+64));   //4 spaces
        }
        printf("\n");
    }
}

Output

Share Me!