Half pyramid


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';


    for(i=1; i <= (input-'A'+1); ++i)
            printf("%c", alphabet);

    return 0;