Pattern 21 : Hollow inverted right angle triangle star pattern using for loops

Spread the love

Write a C program to print below inverted triangle star pattern using for loops:

Sample output :

Enter Number : 5
* * * * * 
*     * 
*   * 
* * 
Note : This post is part of my series on Star Pattern programs in C language, Check out all program HERE.

Program :

  1. /*
  2. C Program to print mirrored right angle triangle

  3. Author : Venkatesh Macha.
  4. Visit www.SillyCodes.com for more C programming tutorials.
  5. */

  6. #include<stdio.h>
  7. int main()
  8. {
  9.     int i,j,k,n;
  10.     printf(“Enter Number : “);
  11.     scanf(“%d”,&n);
  12.     for(i=1;i<=n;i++)
  13.     {
  14.       for(j=1;j<=n;j++)
  15.         {
  16.             if(<= (n+1i))
  17.             {
  18.                 if(i==1 || j==1 || j == (n+1i) )
  19.                     printf(“* “);
  20.                 else
  21.                     printf(”  “);
  22.             }
  23.         }
  24.         printf(n);
  25.     }
  26.     return 0;
  27. }

Output:

Output of hollow triangle

You may also like:

More C programs:

C Tutorials with simple Examples:

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply