Saturday, September 24, 2016

ALPHABET Pattern :)

Tags

#include <stdio.h>
#include<conio.h>
main()
{
    int i, j;
    char input, alphabet = 'A';

    printf("Enter the uppercase character you want to print in last row: "); //asking number of rows from user
    scanf("%c",&input); //scanning number of rows user entered

    for(i=1;i<=(input-'A'+1);i++) //tells number of rows
    {
        for(j=1;j<=i;j++) //tells number of letters in a row
        {
            printf("%c", alphabet); //printing pattern
        }
        ++alphabet; //increment letter in next row

        printf("\n"); //jump to next row
    }
    getch();
}
OUTPUT:
A
BB
CCC
DDDD
EEEEEE