Home » C programs

C program for 'Half Pyramid' Pattern

In this C program, we are going to learn how to print a half pyramid. Here, we are reading total number of rows and printing the half pyramid accordingly.
Submitted by Shamikh Faraz, on February 14, 2018

In this program we will learn, how we can print half pyramid using ‘asterisks’ and ‘loops’.

C program

#include <stdio.h>
int main()
	int a, b, rows;
	printf("Enter number of rows");

	for(a=1; a<=rows; a++)
		for(b=1; b<=a; b++)
			printf("* ");
	return 0;


Output - Half pyramid program in C

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions

© https://www.includehelp.com (2015-2018), Some rights reserved.

close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.