write a program that finds the factorial of a number using
recursion?
Answer Posted / bala c king
#include<stdio.h>
#include<conio.h>
void main()
{
int factorial(int);
int n;
clrscr();
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
getch();
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 35 Yes | 14 No |
Post New Answer View All Answers
What is the use of ?
Is it possible to have a function as a parameter in another function?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
What does d mean?
Can one function call another?
What is difference between stdio h and conio h?
What are the advantage of c language?
What is the use of a static variable in c?
What are the string functions? List some string functions available in c.
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is memcpy() function?
How can I handle floating-point exceptions gracefully?
hi send me sample aptitude papers of cts?
Can we compile a program without main() function?
What are the types of data types and explain?