write a program that finds the factorial of a number using
recursion?
Answer Posted / bhargav
#include<stdio.h>
void main()
{
int factorial(int);
int n;
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 13 Yes | 4 No |
Post New Answer View All Answers
Tell me when would you use a pointer to a function?
What is strcmp in c?
Is c call by value?
What is meant by type casting?
How do you sort filenames in a directory?
what are the different storage classes in c?
What is the use of extern in c?
What is the difference between break and continue?
How many keywords are there in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What are actual arguments?
What is stack in c?
What is #include stdlib h?
What is a volatile keyword in c?