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
What is pointer and structure in c?
What are reserved words?
how many errors in c explain deply
What are the types of c language?
What is the meaning of && in c?
What is a lookup table in c?
What tq means in chat?
Explain spaghetti programming?
How many types of sorting are there in c?
How can I find out the size of a file, prior to reading it in?
Can you please compare array with pointer?
What is the meaning of 2d in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
find the sum of two matrices and WAP for it.
Can you pass an entire structure to functions?