Skip to content
Home » C Programs » Pyramid Number Pattern Program in C

Pyramid Number Pattern Program in C

Basic pyramid number pattern program in c for beginners to understand the concept of looping statements in c programming language.

Looping Statement in C Program

In C, looping statements repeat the series of statements until the stated condition is no longer true. A loop in C is made up of two parts: the loop body and the control statement. A loop is used to repeatedly execute a set of statements until a certain condition is met. 

A loop is a set of instructions that is repeatedly executed until a given condition is met in computer programming. A loop is a basic programming concept that is often utilised in program development. An infinite loop is one that doesn’t have a way to get out of it.

Return Statement in C

A return statement marks the end of a function’s execution and hands control back to the calling function. The calling function continues execution at the place where the call was made. A return statement can give the caller function a value. 

The return statement marks the end of a function’s execution and hands control back to the calling function. The calling function continues execution at the place where the call was made. The calling function can also get a value via a return statement. 

Pyramid Number Pattern Program in C

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

Output:

Enter number of rows 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5