C Program to Print Left Arrow Star Pattern

Write a C Program to Print the Left Arrow Star Pattern using for loop. In this C example, we used nested for loops to print the stars in the Left arrow pattern.

#include<stdio.h>
int main()
{
 	int i, j, rows; 
 	printf("Enter Left Arrow Star Pattern Rows =  ");
 	scanf("%d", &rows);

    printf("Left Arrow Star Pattern\n");
	for(i = 1; i <= rows; i++)
	{
		for(j = 1; j <= rows - i; j++)
		{
			printf(" ");
		}
        for(j = i; j <= rows; j++)
        {
            printf("*");
        }
		printf("\n");
	}

    for(i = 1; i <= rows; i++)
	{
		for(j = 1; j < i; j++)
		{
			printf(" ");
		}
        for(j = 1; j <= i; j++)
        {
            printf("*");
        }
		printf("\n");
	}

 	return 0;
}
Enter Left Arrow Star Pattern Rows =  7
Left Arrow Star Pattern
      *******
     ******
    *****
   ****
  ***
 **
*
*
 **
  ***
   ****
    *****
     ******
      *******

In this C Program, we replaced the for loop with a while loop to Print Left Arrow Pattern. It also allows entering the symbol to print in a Left arrow shape.

#include<stdio.h>
int main()
{
 	int i, j, rows; 
	char ch;
    
    printf("Symbol to Print as Hollow Inverted Pyramid =  ");
    scanf("%c", & ch);
    
 	printf("Enter Left Arrow Star Pattern Rows =  ");
 	scanf("%d", &rows);

    printf("Left Arrow Star Pattern\n");
	i = 1;
	while( i <= rows)
	{
		j = 1;
		while(j <= rows - i)
		{
			printf(" ");
			j++;
		}
		j = i;
        while(j <= rows)
        {
            printf("%c", ch);
			j++;
        }
		printf("\n");
		i++;
	}

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

 	return 0;
}
Symbol to Print as Hollow Inverted Pyramid =  #
Enter Left Arrow Star Pattern Rows =  5
Left Arrow Star Pattern
    #####
   ####
  ###
 ##
#
#
 ##
  ###
   ####
    #####

In this c example, we twisted the for loop to print the Left arrow star pattern more appropriately.

#include<stdio.h>
int main()
{
 	int i, j, rows; 
 	printf("Enter Left Arrow Star Pattern Rows =  ");
 	scanf("%d", &rows);

    printf("Left Arrow Star Pattern\n");
	for(i = 1; i < rows; i++)
	{
		for(j = 1; j <= rows - i; j++)
		{
			printf(" ");
		}
        for(j = i; j <= rows; j++)
        {
            printf("*");
        }
		printf("\n");
	}

    for(i = 1; i <= rows; i++)
	{
		for(j = 1; j < i; j++)
		{
			printf(" ");
		}
        for(j = 1; j <= i; j++)
        {
            printf("*");
        }
		printf("\n");
	}

 	return 0;
}
C Program to Print Left Arrow Star Pattern 3