print the following pattern



QUESTION:- print the following pattern  

A 

B C  

D E F  

G H I J  

K L M N O  


#include <stdio.h>

#include <conio.h>

int main()

{

    int i, j, alp;

    printf("enter a value: ");

    scanf("%d", &alp);

    char ch = 65; // here we can make a change with (ASCII value and alphabet).

    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 C  

D E F  

G H I J  

K L M N O  


Follow our page for regular updates.

0 Comments