C Program to Print Triangle Alphabets Pattern

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

#include <stdio.h>

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

    printf("\nThe Triangle Alphabets Pattern\n"); 
    
	for (i = 0 ; i < rows; i++ ) 
	{
		alphabet = 65;
		for (j = rows ; j > i; j-- ) 	
		{
			printf(" ");
		}
		for(k = 0; k <= i; k++)
		{
			printf("%c ", alphabet + k);
		}
		printf("\n");
	}

    return 0;
}
C Program to Print Triangle Alphabets Pattern

This C example displays the alphabets in a triangle pattern using a while loop.

#include <stdio.h>

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

    printf("\nThe Triangle Alphabets Pattern\n"); 
    
	while (i < rows) 
	{
		alphabet = 65;
		j = rows ;
		while ( j > i ) 	
		{
			printf(" ");
			j--;
		}
		k = 0;
		while( k <= i)
		{
			printf("%c ", alphabet + k);
			k++;
		}
		printf("\n");
		i++;
	}

    return 0;
}
Enter Triangle Alphabets Pattern Rows = 12

The 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 

C program to print the triangle pattern of alphabets or characters using a do while loop.

#include <stdio.h>

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

    printf("\nThe Triangle Alphabets Pattern\n"); 
    
	do 
	{
		alphabet = 65;
		j = rows ;
		do 	
		{
			printf(" ");

		} while ( --j > i );
		k = 0;
		do
		{
			printf("%c ", alphabet + k);

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

	} while (++i < rows);

    return 0;
}
Enter Triangle Alphabets Pattern Rows = 15

The 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 N O