C Program to Print Right Arrow Alphabets Pattern

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

#include <stdio.h>

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

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

	printf("Printing Right Arrow Alphabets Pattern\n");
	alphabet = 65;

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

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

This C example prints the right arrow pattern of alphabets using a while loop.

#include <stdio.h>

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

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

	printf("Printing Right Arrow Alphabets Pattern\n");
	
	alphabet = 65;
	i = 0;

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

	i = rows - 2;
	while (i >= 0)
	{
		j = 0;
		while (j < i)
		{
			printf(" ");
			j++;
		}
		k = i;
		while (k <= rows - 1)
		{
			printf("%c", alphabet + k);
			k++;
		}
		printf("\n");
		i--;
	}
}
Enter Right Arrow Pattern of Alphabets Rows = 13
Printing Right Arrow Alphabets Pattern
ABCDEFGHIJKLM
 BCDEFGHIJKLM
  CDEFGHIJKLM
   DEFGHIJKLM
    EFGHIJKLM
     FGHIJKLM
      GHIJKLM
       HIJKLM
        IJKLM
         JKLM
          KLM
           LM
            M
           LM
          KLM
         JKLM
        IJKLM
       HIJKLM
      GHIJKLM
     FGHIJKLM
    EFGHIJKLM
   DEFGHIJKLM
  CDEFGHIJKLM
 BCDEFGHIJKLM
ABCDEFGHIJKLM

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.