c program to print pascal triangle with source code
#include
#include
main()
{
int i,j,t,k,z,f1,f2,f3,sp;
sp=20;
clrscr();
for(i=0;i<=4;i++)
{
for(k=0;k
sp-=2;
for(j=0;j<=i;j++)
{
f1=f2=f3=1;
t=i;
while(t!=0)
{
f1=f1*t;
t--;
}
t=j;
while(t!=0)
{
f2=f2*t;
t--;
}
t=i-j;
while(t!=0)
{
f3=f3*t;
t--;
}
z=f1/(f2*f3);
printf("%5d",z);
}
printf("\n");
}
getch();
return 0;
}