C Program to Print Right Pascals Triangle Alphabets Pattern

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

#include <stdio.h>

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

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

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

	alphabet = 65;

	for (i = 0; i <= rows - 1; i++)
	{
		for (j = 0; j <= i; j++)
		{
			printf("%c ", alphabet + j);
		}
		printf("\n");
	}

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

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

#include <stdio.h>

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

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

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

	alphabet = 65;
	i = 0;

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

	i = rows - 1;
	while (i >= 0)
	{
		j = 0;
		while (j < i)
		{
			printf("%c ", alphabet + j);
			j++;
		}
		printf("\n");
		i--;
	}
}
Enter Right Pascal Triangle of Alphabets Rows = 11
The Right Pascal Triangle Alphabets Pattern
A 
A B 
A B C 
A B C D 
A B C D E 
A B C D E F 
A B C D E F G 
A B C D E F G H 
A B C D E F G H I 
A B C D E F G H I J 
A B C D E F G H I J K 
A B C D E F G H I J 
A B C D E F G H I 
A B C D E F G H 
A B C D E F G 
A B C D E F 
A B C D E 
A B C D 
A B C 
A B 
A

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

#include <stdio.h>

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

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

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

	alphabet = 65;
	i = 0;

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

		} while (++j <= i);

		printf("\n");

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

	i = rows - 1;
	do
	{
		j = 0;
		do
		{
			printf("%c ", alphabet + j);

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

	} while (--i > 0);
}
Enter Right Pascal Triangle of Alphabets Rows = 14
The Right Pascal Triangle Alphabets Pattern
A 
A B 
A B C 
A B C D 
A B C D E 
A B C D E F 
A B C D E F G 
A B C D E F G H 
A B C D E F G H I 
A B C D E F G H I J 
A B C D E F G H I J K 
A B C D E F G H I J K L 
A B C D E F G H I J K L M 
A B C D E F G H I J K L M N 
A B C D E F G H I J K L M 
A B C D E F G H I J K L 
A B C D E F G H I J K 
A B C D E F G H I J 
A B C D E F G H I 
A B C D E F G H 
A B C D E F G 
A B C D E F 
A B C D E 
A B C D 
A B C 
A B 
A 

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.