In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in this tutorial, we will create a pyramid character pattern in C using for loop. So you may go through the following topic in C.
Pattern 1: C program for character/alphabet.
This program asks for the alphabet till which you want to print.
Enter the character till which you want to print in uppercase: F
A
B B
C C C
D D D D
E E E E E
F F F F F F
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> int main() { int i, j; char ch, alphabet = 'A'; printf("Enter the character till which you want to print in uppercase: "); scanf("%c", &ch); for (i = 1; i <= (ch - 'A' + 1); ++i) { for (j = 1; j <= i; ++j) printf("%c ", alphabet); ++alphabet; printf("\n"); } return 0; } |
Pattern 2: C program for character/alphabet.
This program asks the user for the number of rows that you want.
Enter the no. of rows: 6
A
B B
C C C
D D D D
E E E E E
F F F F F F
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> void main() { int rows, i, j; char ch = 'A'; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 0; i <= rows; i++) { for (j = 0; j <= i; j++) { printf(" %c", (char)(ch + i)); } printf("\n"); } getch(); } |
Pattern 3: C program for character/alphabet.
Enter the no. of rows: 5
A
A B
A B C
A B C D
A B C D E
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <stdio.h> void main() { int rows, i, j; printf("Enter the no. of rows: "); scanf("%d", &rows); // ASCII value of alphabet 'A' int alphabet = 65; for (i = 0; i < rows; i++) { for (j = 0; j <= i; j++) { printf("%c ", (char)(alphabet + j)); } printf("\n"); } getch(); } |
Pattern 4: C program for character/alphabet.
Enter the no. of rows: 5
E
E D
E D C
E D C B
E D C B A
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <stdio.h> void main() { int rows, i, j; printf("Enter the no. of rows: "); scanf("%d", &rows); // ASCII value of alphabet 'A' int alphabet = 65; for (i = rows - 1; i >= 0; i--) { for (j = rows - 1; j >= i; j--) { printf("%c ", (char)(alphabet + j)); } printf("\n"); } getch(); } |
Pattern 5: C program for character/alphabet.
Enter the no. of rows: 5
A
BB
CCC
DDDD
EEEEE
FFFFFF
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> void main() { int rows, i, j, k; printf("Enter the no. of rows: "); scanf("%d", &rows); // ASCII value of alphabet 'A' int alphabet = 65; for (i = 0; i <= rows; i++) { for (j = 1; j <= rows - i; j++) printf(" "); for (k = 0; k <= i; k++) printf("%c", (char)(i + alphabet)); printf("\n"); } getch(); } |
Pattern 6: C program for character/alphabet.

Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <stdio.h> void main() { int rows, i, j; printf("Enter the no. of rows: "); scanf("%d", &rows); // ASCII value of alphabet 'A' int alphabet = 65; for (i = 1; i <= rows; i++) { int count = rows - 1; int temp = i; for (j = 1; j <= i; j++) { printf("%4c", (char) temp + alphabet - 1); temp = temp + count; count--; } printf("\n"); } getch(); } |
Pattern 7: C program for character/alphabet.
Enter the no. of rows: 5
E
D D
C C C
B B B B
A A A A A
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> void main() { int i, j, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { for (j = 1; j <= i; j++) { printf("%c ", (char)(rows - i + 1 + 64)); } printf("\n"); } } |
Pattern 8: C program for character/alphabet.
Enter the no. of rows: 5
A
B A
C B A
D C B A
E D C B A
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> void main() { int i, j, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { for (j = i; j >= 1; j--) printf("%c ", (char)(j + 64)); printf("\n"); } } |
Pattern 9: C program for character/alphabet.
Enter the no. of rows: 5
A
B C
C D E
D E F G
E F G H I
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> void main() { int i, j, k, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { k = i; for (j = 1; j <= i; j++, k++) printf("%c ", (char)(k + 64)); printf("\n"); } } |
Pattern 10: C program for character/alphabet.
Enter the no. of rows: 5
E
D E
C D E
B C D E
A B C D E
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> void main() { int i, j, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = rows; i >= 1; i--) { for (j = i; j <= rows; j++) printf("%c ", (char)(j + 64)); printf("\n"); } } |
Pattern 11: C program for character/alphabet.
Enter the no. of rows: 5
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
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> void main() { int i, j, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { for (j = 1; j <= (i *2 - 1); j++) printf("%c ", (char)(j + 64)); printf("\n"); } } |
Pattern 12: C program for character/alphabet.
Enter the no. of rows: 5
A
B C
D E F
G H I J
K L M N O
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> void main() { int i, j, k = 1, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { for (j = 1; j <= i; j++, k++) printf("%3c", (char)(k + 64)); //3 = TO GIVE FOUR SPACES printf("\n"); } } |
Pattern 13: C program for character/alphabet.
Enter the no. of rows: 5
a
B c
D e F
g H i J
k L m N o
Source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> void main() { int i, j, k = 0, l = 1, rows; printf("Enter the no. of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; i++) { for (j = 1; j <= i; j++, k++, l++) { if (k % 2 == 0) printf("%3c", (char)(l + 96)); else printf("%3c", (char)(l + 64)); } printf("\n"); } } |