C Program to Print Downward Triangle Mirrored Alphabets Pattern

Write a C program to print downward triangle mirrored alphabets pattern using for loop.

#include <stdio.h>

int main()
{
	int rows;
	
	printf("Enter Downward Triangle of Mirrored Alphabets Rows = ");
	scanf("%d", &rows);

	printf("Printing Downward Triangle of Mirrored Alphabets Pattern\n");
	int alphabet = 65;

	for (int i = 0; i <= rows - 1; i++)
	{
		for (int j = i; j <= rows - 1; j++)
		{
			printf("%c ", alphabet + j);
		}
		for (int k = rows - 2; k >= i; k--)
		{
			printf("%c ", alphabet + k);
		}
		printf("\n");
	}
}
C Program to Print Downward Triangle Mirrored Alphabets Pattern

This C example prints the downward triangle pattern of mirrored alphabets using a while loop.

#include <stdio.h>

int main()
{
	int i, j, k, alphabet, rows;
	
	printf("Enter Downward Triangle of Mirrored Alphabets Rows = ");
	scanf("%d", &rows);

	printf("Printing Downward Triangle of Mirrored Alphabets Pattern\n");
	alphabet = 65;
	i = 0;

	while (i <= rows - 1)
	{
		j = i;
		while (j <= rows - 1)
		{
			printf("%c ", alphabet + j);
			j++;
		}

		k = rows - 2;
		while (k >= i)
		{
			printf("%c ", alphabet + k);
			k--;
		}
		printf("\n");
		i++;
	}
}
Enter Downward Triangle of Mirrored Alphabets Rows = 16
Printing Downward Triangle of Mirrored Alphabets Pattern
A B C D E F G H I J K L M N O P O N M L K J I H G F E D C B A 
B C D E F G H I J K L M N O P O N M L K J I H G F E D C B 
C D E F G H I J K L M N O P O N M L K J I H G F E D C 
D E F G H I J K L M N O P O N M L K J I H G F E D 
E F G H I J K L M N O P O N M L K J I H G F E 
F G H I J K L M N O P O N M L K J I H G F 
G H I J K L M N O P O N M L K J I H G 
H I J K L M N O P O N M L K J I H 
I J K L M N O P O N M L K J I 
J K L M N O P O N M L K J 
K L M N O P O N M L K 
L M N O P O N M L 
M N O P O N M 
N O P O N 
O P O 
P 

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.