Home » C programs

C program for 'Reverse Half Pyramid' Pattern



In this C program, we are implementing logic to print Reverse Half Pyramid pattern using asterisks and loops (nested loops).
Submitted by Shamikh Faraz, on February 16, 2018

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

C program

#include<stdio.h>

int main ()
{  
	int a,b,rows;  
	printf("Enter number of rows \t");
	scanf("%d",&rows);
	
	//decreases the number of rows
	for (a=rows;a>=1;a--)  
	{			
		//prints star in increasing order   
		for (b=1;b<=a;b++) 
		{      
			printf("* ");  
		}  
		printf("\n");
	}
	
	return 0;
}

Output

Output - Reverse Half Pyramid Pattern






Was this page helpful? YES NO

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.