C Program to Print Triangle of Same Alphabets Pattern

Write a C program to print a triangle pattern of the same alphabets in each row using for loop.

#include <stdio.h>

int main()
{
	int rows;

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

	printf("Printing Triangle of Same Alphabets in each Row\n");

	int alphabet = 65;

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

This C pattern example prints the triangle of the same alphabet in every single row using a while loop.

#include <stdio.h>

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

	printf("Printing Triangle of Same Alphabets in each Row\n");

	alphabet = 65;

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

		k = 0;
		while (k <= i)
		{
			printf("%c ", alphabet + i);
			k++;
		}

		printf("\n");
		i++;
	}
}
Enter Triangle of Same Row Alphabets Rows = 13
Printing Triangle of Same Alphabets in each Row
            A 
           B B 
          C C C 
         D D D D 
        E E E E E 
       F F F F F F 
      G G G G G G G 
     H H H H H H H H 
    I I I I I I I I I 
   J J J J J J J J J J 
  K K K K K K K K K K K 
 L L L L L L L L L L L L 
M M M M M M M M M M M M M 

C Program to Print Triangle of Same Alphabets Pattern using a do while loop.

#include <stdio.h>

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

	printf("Printing Triangle of Same Alphabets in each Row\n");

	i = 0;
	do
	{
		j = rows - 1;
		do
		{
			printf(" ");

		} while (j-- > i);

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

		} while (++k <= i);

		printf("\n");

	} while (++i <= rows - 1);
}
Enter Triangle of Same Row Alphabets Rows = 15
Printing Triangle of Same Alphabets in each Row
               A 
              B B 
             C C C 
            D D D D 
           E E E E E 
          F F F F F F 
         G G G G G G G 
        H H H H H H H H 
       I I I I I I I I I 
      J J J J J J J J J J 
     K K K K K K K K K K K 
    L L L L L L L L L L L L 
   M M M M M M M M M M M M M 
  N N N N N N N N N N N N N N 
 O O O O O O O O O O O O O O O