C programs to print alphabet pattern

C programs to print alphabet pattern


Introduction

In this article, I have explained the list of all alphabet pattern programs in c programming language. I have used Code::Blocks IDE for debugging purpose. But you can use any C programming language compiler as per your availability.


techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

Alphabet pattern : 1

A
BB
CCC
DDDD
EEEEE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<stdio.h>
void main()
{
    int i, j;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%c",'A'-1 + i);
        }
        printf("\n");
    }
}

Alphabet pattern : 2

AAAAA

BBBB

CCC

DD

E

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<stdio.h>
void main()
{
    int i, j;
    for(i=1;i<=5;i++)
    {
        for(j=5;j>=i;j--)
        {
            printf("%c",'A'-1 + i);
        }
        printf("\n");
    }
}

Alphabet pattern : 3

A
AB
ABC
ABCD
ABCDE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 : 4

E

DE

CDE

BCDE

ABCDE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 : 5

A
BA
CBA
DCBA
EDCBA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 : 6

E

ED

EDC

EDCB

EDCBA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 7

E

DD

CCC

BBBB

AAAAA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 8

EEEEE

DDDD

CCC

BB

A

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 9

EDCBA

EDCB

EDC

ED

E

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 10

EDCBA

DCBA

CBA

BA

A

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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 11

A

ABA

ABCBA

ABCDCBA

ABCDEDCBA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>

void main()
{
    int ch=65;
    int i,j,k,m;
    for(i=1;i<=5;i++)
    {
        for(j=5;j>=i;j--)
            printf(" ");
        for(k=1;k<=i;k++)
            printf("%c",ch++);
            ch--;
        for(m=1;m<i;m++)
            printf("%c",--ch);
        printf("\n");
        ch=65;
    }
}

Alphabet pattern 12

I

IN

IND

INDI

INDIA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>

void main()

{
    char s[]="INDIA";
    int i,j;

    for(i=0;s[i];i++)
    {
        for(j=0;j<=i;j++)

        printf("%c",s[j]);

        printf("\n");
    }

}

     


Alphabet pattern 13

1A2B3C4D5E
1A2B3C4D
1A2B3C
1A2B
1A
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j,k;
  6.  
  7. for(i=5; i>=1; i--)
  8. {
  9. for(j=1, k='A'; j<=i; j++,k++)
  10. {
  11. printf("%d%c",j,k);
  12. }
  13.  
  14. printf("\n");
  15. }
  16.  
  17. return 0;
  18. }
  19.  

Alphabet pattern 14

A
BAB
CBABC
DCBABCD
EDCBABCDE
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j;
  6. char CH='A';
  7. int space=4;
  8.  
  9. for(i=1; i<=5; i++)
  10. {
  11.  
  12. for(j=1; j<=space; j++)
  13. printf(" ");
  14.  
  15. //first part of the row
  16. for(j=CH; j>='A'; j--)
  17. printf("%c",j);
  18.  
  19. //second part of the row
  20. for(j='B'; j<=CH; j++)
  21. printf("%c",j);
  22.  
  23. printf("\n");
  24. CH++;
  25. space--;
  26. }
  27.  
  28. return 0;
  29. }
  30.  

Alphabet pattern 15

ABCDEDCBA
ABCD DCBA
ABC   CBA
AB     BA
A       A
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j;
  6. char CH='E';
  7. int space=1;
  8.  
  9. for(i=1; i<=5; i++)
  10. {
  11. //first part of the row
  12. for(j='A'; j<=CH; j++)
  13. printf("%c",j);
  14.  
  15. //remove last character of first part of first row
  16. if(i==1)
  17. printf("\b");
  18.  
  19. //spaces between first, second part of the row
  20. for(j=1; j<space; j++)
  21. printf(" ");
  22.  
  23.  
  24. for(j=CH; j>='A'; j--)
  25. printf("%c",j);
  26.  
  27. printf("\n");
  28. CH--;
  29. space++;
  30. }
  31.  
  32. return 0;
  33. }
  34.  

Alphabet pattern 16

A 
B C 
D E F 
G H I J 
K L M N O
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j;
  6. char ch='A';
  7.  
  8. for(i=1;i<=5;i++)
  9. {
  10. for(j=1;j<=i;j++)
  11. {
  12. printf("%c ",ch++);
  13. }
  14. printf("\n");
  15. }
  16.  
  17. return 0;
  18. }
  19.  

Alphabet pattern 17

         A
       B A B
     C B A B C
   D C B A B C D
 E D C B A B C D E
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,n=5,j;
  6.  
  7. for(i=1;i<=n;i++)
  8. {
  9. for(j=1;j<=n-i;j++)
  10. {
  11. printf(" ");
  12. }
  13. for(j=i;j>0;j--)
  14. {
  15. printf(" %c",(char)(j+64));
  16. }
  17. for(j=2;j<=i;j++)
  18. {
  19. printf(" %c",(char)(j+64));
  20. }
  21. printf("\n");
  22. }
  23. }
  24.  

Alphabet pattern 18

A
B F
C G J
D H K M
E I L N O
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,j,diff,value,n=5;
  6.  
  7. for(i=1;i<=n;i++)
  8. {
  9. diff=n-1;
  10. value=i;
  11. for(j=1; j<=i; j++)
  12. {
  13. printf("%4c",(char)(value+64));
  14. value=value+diff;
  15. diff--;
  16. }
  17. printf("\n");
  18. }
  19. }
  20.  

Alphabet pattern 19

A
A B C
A B C D E
A B C D E F G
A B C D E F G H I
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,j,n=5;
  6.  
  7. for(i=1;i<=n;i++)
  8. {
  9. for(j=1;j<=(i*2-1);j++)
  10. {
  11. printf("%c",(char)(j+64));
  12. }
  13. printf("\n");
  14. }
  15. }
  16.  

Alphabet pattern 20

E F G H I
D E F G
C D E
B C
A
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,j,k,n=5;
  6.  
  7. for(i=n;i>=1;i--)
  8. {
  9. k = i;
  10. for(j=1;j<=i;j++,k++)
  11. {
  12. printf("%c",(char)(k+64));
  13. }
  14. printf("\n");
  15. }
  16. }
  17.  

Alphabet pattern 21

A B C D E
B C D E
C D E
D E
E
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,j,n=5;
  6. for(i=1;i<=n;i++)
  7. {
  8. for(j=i;j<=n;j++)
  9. {
  10. printf("%c",(char)(j+64));
  11. }
  12. printf("\n");
  13. }
  14. }
  15.  

Alphabet pattern 22

        A
      B B
    C C C
  D D D D
E E E E E
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. int i,j,k,n=5;
  6.  
  7. for(i=1;i<=n;i++)
  8. {
  9. for(j=1;j<=n-i;j++)
  10. {
  11. printf(" ");
  12. }
  13. for(k=1;k<=i;k++)
  14. {
  15. printf("%c",(char)(i+64));
  16. }
  17. printf("\n");
  18. }
  19. }
  20.  





Related Topics



Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.