pascal triangle program

Answer Posted / azad sable, chiplun

void main()
{
int i,j,k,t,f1,f2,f3,z,sp;
sp=20;
clrscr();
for(i=0;i<=4;i++)
{
for(k=0;k<sp-1;k++)
printf("");
sp=0;
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("%4d",z);
}
printf("\n");
}
getch():
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c is a mother language?

638


What functions are used for dynamic memory allocation in c language?

694


Is c++ based on c?

749


Was 2000 a leap year?

738


What is a structure in c language. how to initialise a structure in c?

695






Differentiate abs() function from fabs() function.

689


What is c++ used for today?

755


Write a program to reverse a given number in c language?

723


Which built-in library function can be used to match a patter from the string?

858


What do you mean by a sequential access file?

717


can any one tel me wt is the question pattern for NIC exam

1651


write a c program to find the sum of five entered numbers using an array named number

1732


What is the advantage of a random access file?

738


Explain what is wrong in this statement?

736


Explain the ternary tree?

693