what is the coding of display the factorial of a number
using array and function?



what is the coding of display the factorial of a number using array and function?..

Answer / balaji ganesh

#include<stdio.h>
int fact(int m)
{
int i,f=1;
for(i=m;i>0;i--)
f=f*m--;
return f;
}
void main()
{
int n,s;
clrscr();
scanf("%d",&n,printf("enter the number:"));
s=fact(n);
printf("factorial of %d is=%d",n,s);
getch();
}

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Interview Questions

which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

0 Answers  


can we define a function in structure?

2 Answers  


Is the exit() function same as the return statement? Explain.

0 Answers   Agilent, ZS Associates,


what is foreign key in c language?

1 Answers   ADP,


Define C in your own Language.

0 Answers   Motorola,


How can I recover the file name given an open stream?

0 Answers  


What does sizeof return c?

0 Answers  


for(;;) printf("C language") What is out put of above??

2 Answers   Practical Viva Questions,


Why doesn't C support function overloading?

2 Answers  


What compilation do?

7 Answers   Geometric Software, Infosys,


Explain how do you list files in a directory?

0 Answers  


How can I call a function with an argument list built up at run time?

0 Answers  


Categories