Search C Program | nimishsoft@gmail.com

Alphabet Pattern - 2

E
DE
CDE
BCDE
ABCDE


#include <stdio.h>

int main()
{
    int i, j;
    for(i=5;i>=1;i--)
    {
        for(j=i;j<=5;j++)
        {
            printf("%c",'A' + j-1);
        }
        printf("\n");
    }

    return 0;
}

4 comments:

  1. //A much simpler code than yours

    #include

    main()
    {
    int n, i,j;
    printf("Enter the no of rows");
    scanf("%d",&n);
    int k;
    for(i=1; i<=n; i++)
    {
    for(j=1; j<=i; j++)
    {
    printf("%c",'A'+n-j);

    }
    printf("\n");
    }
    }

    ReplyDelete
    Replies
    1. D you run your code? It is not the right code for that output.

      Delete
    2. yes its working, check here http://codepad.org/NSBu7V4T

      Delete