In this C program, we will learn how to write a program to print a half pyramid using alphabets.
Here is the code of the program to print a half pyramid using alphabets.
/* C Program to Print Half Pyramid Using Alphabets
    A 
    A B 
    A B C 
    A B C D 
    A B C D E  
*/
#include <stdio.h>
int main()
{
    int i,j,number;
    char ch;
    printf("Enter The Number of Rows: ");
    scanf("%d",&number);
    for(i=1;i<=number;i++)
    {
        ch='A';
        for(j=1;j<=i;j++)
        {
            printf("%c ",ch++);
        }
        printf("\n");
    }
    return 0;
}
Enter The Number of Rows: 6
A
A B
A B C
A B C D
A B C D E
A B C D E F
--------------------------------
Process exited after 1.686 seconds with return value 0
Press any key to continue . . .
Comments