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
Where are the auto variables stored?
List some basic data types in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
What is the code in while loop that returns the output of given code?
What is pre-emptive data structure and explain it with example?
How is a macro different from a function?
What is the use of ?: Operator?
What is the meaning of ?
What is the function of multilevel pointer in c?
What is huge pointer in c?
What does d mean?
What is the concatenation operator?
while initialization of array why we use a[][2] why not a[2][]...?
State the difference between realloc and free.
write a c program for swapping two strings using pointer