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

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

5806


Is exit(status) truly equivalent to returning the same status from main?

588


What are operators in c?

584


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

618


program for reversing a selected line word by word when multiple lines are given without using strrev

1948






What is operator precedence?

645


What is a rvalue?

752


What are data types in c language?

587


What is meant by preprocessor in c?

537


#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

773


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15052


Explain how can you tell whether a program was compiled using c versus c++?

579


Does c have function or method?

592


What is the benefit of using an enum rather than a #define constant?

662


What is the purpose of ftell?

601