Pascal's triangle :- In mathematics, Pascal's triangle is a triangular array of the binomial coefficients. In much of the Western world it is named after French mathematician Blaise Pascal, although other mathematicians studied it centuries before him in India, Iran, China, Germany, and Italy.
Solution :-
Output:-
Solution :-
#include<stdio.h>
long fact(int);
int main()
{
int counter,i,j;
printf("Enter The No. Of Terms You Want To Print: ");
scanf("%d",&counter);
for(i=0;i<counter;i++)
{
printf(" ");
for(j=0;j<=i;j++)
printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
printf("\n");
}
return 0;
}
//function starting
long fact(int num)
{
long f=1;
int i=1;
while(i<=num)
{
f=f*i;
i++;
}
return f;
//funtion returning a value
}
Output:-
0 Comments: