C Program  to print inverted half pyramid. 


Source Code:

  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int i, j, n;

  5.     printf("Enter N: ");
  6.     scanf("%d", &n);
  7.     for (i=n;i>=1;i--)
  8.      {
  9.       for(j=i;j<=(n-1);j++)
  10.       {
  11.       printf(" ");
  12.       }
  13.         for(j=1;j<=i;j++)
  14.           {
  15.           printf("*");
  16.           }
  17.            printf("\n");
  18.      }
  19.     
  20.     
  21.      return 0;
  22.  }

Outputs:



0 comments:

Post a Comment