Skip to content
Home » C program to print half pyramid pattern

C program to print half pyramid pattern

Below is the program to print half pyramid pattern like

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

#include <stdio.h>
int main(){
	int r,i,j;
	printf("Enter rows: ");
	scanf("%d",&r);
	for(i=1;i<=r;i++){
		for(j=0;j<i;j++){
			printf("%d",i);
		}
		printf("\n");
	}
}

Output:

Enter rows: 4
1
22
333
4444