Printing Inverted/Pascal’s Triangle

Written by

Namrata Jangid

Inverted Pascal Triangle/Pyramid Program in C

With special characters

The code:

#include<stdio.h>

int main()

{

int n, i, j, k;

printf("Enter number of rows: ");

scanf("%d", & amp; n);

printf("\n");

for (i = n; i & gt; = 1; --i)

{

  for (k = 0; k &amp; lt; n - i; ++k)

     printf("  ");

  for (j = i; j &amp; lt; = 2 * i - 1; ++j)

     printf("* ");

  for (j = 0; j &amp; lt; i - 1; ++j)

     printf("* ");

  printf("\n");

}

return 0;

}

The output for the above code is:

Enter number of rows:  5




*

Printing Inverted/Pascal&#8217;s Triangle