C program to print left arrow star pattern
*****
****
***
**
*
**
***
****
*****
C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)
1894Program:
/** * C program to print left arrow star pattern */ #include 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
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.
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.