Home » C program Half Pyramid using *, Increment & Decrement Operators

C program Half Pyramid using *, Increment & Decrement Operators

Learn about C program Half Pyramid using *, Increment & Decrement Operators in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

C program Half Pyramid using *, Increment & Decrement Operators

Program:

#include<stdio.h>
int main()
{
  int i,j;
  for(i=5;i>=1;i--)
  {
    for(j=i;j<=5;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 :
Pattern Programs in C for Half Pyramid
Pattern Program 10 in C