Skip to content
Home » Inverted half pyramid star pattern in C

Inverted half pyramid star pattern in C

Learn about Inverted half pyramid star pattern in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Inverted half pyramid star pattern in C

Print a pattern like below:

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

Program:

#include<stdio.h>
int main()
{
  for(int i=5; i>=1; i--)
  {
    for(int j=i; j>=1; j--)
    {
      printf("* "); 
    }

    printf("\n"); 
  }

  return 0;
}

Output:

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

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

Similar Codes :
Half pyramid star pattern using both increment and decrement operators in C
Pyramid Star Pattern in C