write a program that finds the factorial of a number using
recursion?
Answer Posted / abhinandan
#include<stdio.h>
main()
{
int a, fact;
printf("\nEnter any number: ");
scanf ("%d", &a);
fact=rec (a);
printf("\nFactorial Value = %d", fact);
}
rec (int x)
{
int f;
if (x==1)
return (1);
else
f=x*rec(x-1);
return (f);
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is malloc return c?
What is sizeof array?
Is a house a shell structure?
What is the Purpose of 'extern' keyword in a function declaration?
Can main () be called recursively?
Explain what is the difference between a free-standing and a hosted environment?
Does c have function or method?
What are the advantages of using macro in c language?
Explain union.
What is the use of bit field?
What are the rules for the identifier?
The file stdio.h, what does it contain?
How do I swap bytes?
What is extern keyword in c?
What is table lookup in c?