Skip to content
Home » Pattern Program in C for Inverted Full Pyramid

Pattern Program in C for Inverted Full Pyramid

Learn about Pattern Program in C for Inverted Full Pyramid in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Pattern Program in C for Inverted Full Pyramid

To print the below pattern follow the below C program.

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

Program:

#include<stdio.h>
int main()
{
  int n, r, c, s;

  printf("Enter number of rows: ");
  scanf("%d",&n);

  for(r=n;r>=1;r--)
  {
    for(s=1;s<=n-r;s++) printf(" ");
    for(c=1;c<=r;c++) printf("* ");

    printf("\n");
  }

  return 0;
}

Output:

Enter number of rows: 5
* * * * * 
 * * * * 
  * * * 
   * * 
    * 

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Pattern Program 20 in C
Pattern Programs 19 in C