print the following pattern


QUESTION:- print the following pattern  

A  

A B  

A B C  

A B C D  


#include <stdio.h>

#include <conio.h>

int main()

{

    int i, j;

    char ch = 'A';

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

    {

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

        {

            printf("%c ", ch);

            ch++;
        }

        ch = 'A'; // start from A

        printf("\n");
    }

    return 0;

    getch();
}


OUTPUT

A 

A B

A B C

A B C D

A B C D E

Follow our page for regular updates.

0 Comments