C program to print star pattern of inverted triangle shape

C program to print star pattern of inverted triangle shape.

For N=5,


* * * * *

 * * * *

  * * *

   * *

    *

  1. #include<stdio.h>
  2. int main()
  3. {
  4.  int i,j,n=5;
  5.  
  6.  for(j=0; j<n; j++)
  7.  {
  8.   for(i=n; i>n-j; i--) 
  9.      printf(" ");
  10.   for(i=0; i<n-j; i++) 
  11.      printf("* ");
  12.   printf("\n");
  13.  }
  14.  return 0;
  15. }
Output

* * * * *
 * * * *
  * * *
   * *
    *

See Next program

Comments