Pattern Printing II

Write a C program for the following pattern 

Sample Input    : 5   // no. of rows to print

Sample Output :

E D C B A
E D C B
E D C
E D
E

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
int main()
{
    char a='A',c;
    int i,j,n;
    printf("Enter number of rows to print : ");
    scanf("%d",&n);
    for(i=n-1;i>=0;i--)
    {
        c=a+n-1;
        for(j=0;j<i+1;j++)
        {
            printf("%c",c);
            c=c-1;
        }
        printf("\n");
    }
    return 0;
}

OUTPUT :


0 comments