Home C Programming Language / Programs / C program to print left arrow star pattern ***** **** *** ** * ** *** **** *****
🚀 Programming Example

C program to print left arrow star pattern
     *****
   ****
  ***
 **
*
 **
  ***
   ****
    *****

👁 1,999 Views
💻 Practical Program
📘 Step Learning
Write a C program to print left arrow star pattern series using for loop. How to print left arrow (mirrored arrow) star pattern structure in C program. Logic to print left arrow star pattern in C programming.

💻 Program Code

/**
 * C program to print left arrow star pattern
 */

#include <stdio.h>

int main()
{
    int i, j, n;

    // Input number of rows from user
    printf("Enter value of n : ");
    scanf("%d", &n);

    // Print upper part of the arrow
    for(i=1; i<n; i++)
    {
        // Print trailing (n-rownumber) spaces
        for(j=1; j<=(n-i); j++)
        {
            printf(" ");
        }

        // Print inverted right triangle
        for(j=i; j<=n; j++)
        {
            printf("*");
        }

        printf("\n");
    }

    // Print bottom part of the arrow
    for(i=1; i<=n; i++)
    {
        // Print trailing (rownumber-1) spaces
        for(j=1; j<i; j++)
        {
            printf(" ");
        }

        // Print the right triangle
        for(j=1; j<=i; j++)
        {
            printf("*");
        }

        printf("\n");
    }

    return 0;
}
Output
                        

🖥 Program Output

Enter value of n : 5
    *****
   ****
  ***
 **
*
 **
  ***
   ****
    *****
                            

📘 Explanation

Required knowledge

Basic C programming, For loop, Nested loop

Logic to print left arrow star pattern

Let's first divide this pattern in two parts to make our task easy.

If you have noticed number of spaces in the upper part per row is n - rownumber and bottom part contains rownumber - 1 spaces per row (where n is the total number of rows). If you ignore the leading spaces in both parts you will notice that the upper part is similar to inverted right triangle and lower part is similar to right triangle star pattern.

📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.