Half pyramid

Description:

Sam had a program for a full pyramid. But he didnt know that how to print half pyramid by using alphabets. So help him to write a program to print half pyramid using alphabets using increment operator Test Case 1 Input (stdin) G Expected Output A BB CCC DDDD EEEEE FFFFFF GGGGGGG Test Case 2 Input (stdin) B Expected Output A BB

Program :

#include <stdio.h>

int main()

{

    int i, j;

    char input, alphabet = 'A';

  scanf("%c",&input);


    for(i=1; i <= (input-'A'+1); ++i)

    {

        for(j=1;j<=i;++j)

        {

            printf("%c", alphabet);

        }

        ++alphabet;


        printf("\n");

    }

    return 0;

}