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

main() { printf("hello"); fork(); }

0 Answers   Wilco,


What is the size of structure pointer in c?

0 Answers  


Why do we need volatile in c?

0 Answers  


What does c mean in standard form?

0 Answers  


What are the header files used in c language?

0 Answers  






Which is better between malloc and calloc?

0 Answers  


#include <stdio.h> int main() { if ("X" <"x") printf("X smaller than x "); } my question is whats the mistake in this program? find it and please tell me..

3 Answers  


Explain what math functions are available for integers? For floating point?

0 Answers  


What is the c value paradox and how is it explained?

0 Answers  


What is the general form of a C program?

0 Answers  


Can u return two values using return keyword? If yes, how? If no, why?

7 Answers  


I have one doubt. What does below statement mean? #define sizeof(operator) where operator can be int or float etc. Does this statement meaningful and where it can be used?

1 Answers  


Categories