C Program to Print Right Triangle of Consecutive Alphabets Pattern

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

#include <stdio.h>

int main()
{
	int rows;

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

	printf("Right Triangle of Consecutive Alphabets Pattern\n");
	int alphabet = 65;

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

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

#include <stdio.h>

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

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

	printf("Right Triangle of Consecutive Alphabets Pattern\n");
	alphabet = 65;

	i = 0;

	while (i <= rows - 1)
	{
		j = 0;

		while (j <= i)
		{
			printf("%c ", alphabet++);
			j++;
		}
		printf("\n");
		i++;
	}
}
Enter Right Triangle of Consecutive Alphabets Rows = 9
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 
e f g h i j k l m 

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

#include <stdio.h>

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

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

	printf("Right Triangle of Consecutive Alphabets Pattern\n");
	
	alphabet = 65;

	i = 0;

	do
	{
		j = 0;

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

		} while (++j <= i);

		printf("\n");

	} while (++i <= rows - 1);
}
Enter Right Triangle of Consecutive Alphabets Rows = 10
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 
e f g h i j k l m 
n o p q r s t u v w

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.