C Program to Print Mirrored Right Triangle Alphabets Pattern

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

#include <stdio.h>

int main()
{
	int rows;

	printf("Enter Mirrored Right Triangle of Alphabets Rows = ");
	scanf("%d", &rows);

	printf("The Mirrored Right Triangle Alphabets Pattern\n");

	int alphabet = 65;

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

This C program prints the mirrored right angled triangle of alphabets pattern using a while loop.

#include <stdio.h>

int main()
{
	int rows, i, j, k, alphabet;

	printf("Enter Mirrored Right Triangle of Alphabets Rows = ");
	scanf("%d", &rows);

	printf("The Mirrored Right Triangle Alphabets Pattern\n");

	alphabet = 65;
	i = 0;

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

		k = 0;
		while (k <= i)
		{
			printf("%c", alphabet + i);
			k++;
		}
		printf("\n");
		i++;
	}
}
Enter Mirrored Right Triangle of Alphabets Rows = 17
The Mirrored Right Triangle Alphabets Pattern
                 A
                BB
               CCC
              DDDD
             EEEEE
            FFFFFF
           GGGGGGG
          HHHHHHHH
         IIIIIIIII
        JJJJJJJJJJ
       KKKKKKKKKKK
      LLLLLLLLLLLL
     MMMMMMMMMMMMM
    NNNNNNNNNNNNNN
   OOOOOOOOOOOOOOO
  PPPPPPPPPPPPPPPP
 QQQQQQQQQQQQQQQQQ

This C example uses the do while loop to print the mirrored right angled triangle pattern of alphabets.

#include <stdio.h>

int main()
{
	int rows, i, j, k, alphabet;

	printf("Enter Mirrored Right Triangle of Alphabets Rows = ");
	scanf("%d", &rows);

	printf("The Mirrored Right Triangle Alphabets Pattern\n");

	alphabet = 65;
	i = 0;

	do
	{
		j = 1;
		do
		{
			printf(" ");

		} while (j++ <= rows - i);

		k = 0;
		do
		{
			printf("%c", alphabet + i);

		} while (++k <= i);
		printf("\n");

	} while (++i < rows);
}
Enter Mirrored Right Triangle of Alphabets Rows = 15
The Mirrored Right Triangle Alphabets Pattern
                A
               BB
              CCC
             DDDD
            EEEEE
           FFFFFF
          GGGGGGG
         HHHHHHHH
        IIIIIIIII
       JJJJJJJJJJ
      KKKKKKKKKKK
     LLLLLLLLLLLL
    MMMMMMMMMMMMM
   NNNNNNNNNNNNNN
  OOOOOOOOOOOOOOO

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.