Skip to content
Home » Half Pyramid using Numbers in C

Half Pyramid using Numbers in C

Learn about Half Pyramid using Numbers 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.

Half Pyramid using Numbers in C

Pattern:

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

Program:

#include<stdio.h>
int main()
{
  for(int i=1;i<=5;i++)
  {
    for(int j=1;j<=i;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 :
C program Half Pyramid using *, Increment & Decrement Operators
Pattern Programs in C for Half Pyramid