Alphabet Patterns - C programs

Alphabet Patterns - some vey useful examples of Alphabet Patterns C program are as follows.

Alphabet Pattern - 1

A
AB
ABC
ABCD
ABCDE

C program

#include<stdio.h>

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

    return 0;
}

Alphabet Pattern - 2

E
DE
CDE
BCDE
ABCDE

C program

#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;
}

Alphabet Pattern - 3

A
BA
CBA
DCBA
EDCBA

C program

#include<stdio.h>

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

    return 0;
}

Alphabet Pattern - 4

E
ED
EDC
EDCB
EDCBA

C program

#include<stdio.h>

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

    return 0;
}

Alphabet Pattern - 5

ABCDE
ABCD
ABC
AB
A

C program

#include<stdio.h>

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

    return 0;
}

Alphabet Pattern - 6

ABCDE
BCDE
CDE
DE
E

C program

#include<stdio.h>

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

    return 0;
}

Alphabet Pattern - 7

EDCBA
DCBA
CBA
BA
A

C program

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

    return 0;
}

Alphabet Pattern - 8

EDCBA
EDCB
EDC
ED
E

C program

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

    return 0;
}

Alphabet Pattern - 9

A
BB
CCC
DDDD
EEEEE

C program

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

    return 0;
} 

Alphabet Pattern - 10

E
DD
CCC
BBBB
AAAAA

C program

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

    return 0;
} 

Alphabet Pattern - 11

EEEEE
DDDD
CCC
BB
A

C program

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

    return 0;
}

Alphabet Pattern - 12

AAAAA
BBBB
CCC
DD
E

C program

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

    return 0;
} 

No comments:

Post a Comment