C Program Nested Loop (inverted Triangle) C Code

How to write a C Program Nested Loop (inverted Triangle) C Code in C Programming Language ?


Here is a C Code for Nested loop ( inverted Triangle) with Output.

Solution:
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,j,k,l;
  5.     for(i=1;i<=5;i++)
  6.     {
  7.         for(j=1;j<=i;j++)
  8.         {
  9.             printf(" ");
  10.         }
  11.         for(k=5;k>=i;k--)
  12.         {
  13.             printf("*");
  14.         }
  15.         for(l=i;l<=4;l++)
  16.         {
  17.             printf("*");
  18.         }
  19.         printf("\n");
  20.     }
  21. }
  22.  
  23. /* Output will be like
  24.  
  25. *********
  26.  *******
  27.   *****
  28.    ***
  29.     *
  30. */


Learn More :