print the following pattern



QUESTION:- print the following pattern  

A  

B B  

C C C  

D D D D 

E E E E E  



#include <stdio.h>

#include <conio.h>

int main()

{

    int i, j, alp;

    printf("enter a value: ");

    scanf("%d", &alp);

    char ch = 'A';

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

    {

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

        {

            printf("%c ", ch);
        }

        ch++;

        printf("\n");
    }

    return 0;

    getch();
}


OUTPUT

enter a value: 5 

A  

B B  

C C C  

D D D D 

E E E E E  


Follow our page for regular updates.

0 Comments