#include <stdio.h>
int fact(int);
int main()
{
int i,j,n;
printf("\nEnter the Limit :");
scanf("%d", &n);
for(i=0; i<=n;i++)
{
for(j=0;j<=n-i;j++) //To reduce the space
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf(" %d",fact(i)/(fact(j)*fact(i-j)));
}
printf("\n");
}
return 0;
}
int fact(int n) //to find the factorial value. this will pass an integer value for main function
{
int f=1,i;
for(i=1;i<=n;i++)
{
f=f*i;
}
return(f);
}
Comments
Post a Comment