Home » C Programs » Pascal Triangle Program in C

Pascal Triangle Program in C

Pascal triangle program in c. Floyd’s triangle is a natural-numbers triangular array used in computer science education. Robert Floyd was the inspiration for the name. 

For Loop in C

A for loop is a repetition control structure that allows us to create a loop that runs a set number of times. The loop allows us to do an arbitrary number of steps in a single line. A loop is used to repeatedly execute a set of statements until a certain condition is met. Incrementing number value in floyd triangle program in c

Stdio.h in C Program

stdio. h is a C header file that provides C declarations and macro definitions that can be shared across many files. The printf() and scanf() functions are part of the stdio. h standard input/output function.

The acronym STDIO stands for Standard Input-Output. It features various built-in functions, such as int printf() and scanf(). CONIO stands for Console Input-Output and includes functions such as clrscr(), getch(), and others.

Pascal Triangle Program in C

//Pascal Triangle Program in C
#include <stdio.h> 
int main() 
{ 
int num, i, j, k = 1; 
printf( "Enter the Number of Rows \n"); 
scanf( "%d", &num); 
for (i = 1; i <= num; i++) 
{ 
for (j = 1; j <= i; j++) 
{ 
printf(" %2d", k++); 
} 
printf( "\n"); 
} 
} 

Enter the Number of Rows
5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15