write a program that finds the factorial of a number using
recursion?
Answer Posted / meenakshi
#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 ? | 17 Yes | 8 No |
Post New Answer View All Answers
What are qualifiers?
what is the format specifier for printing a pointer value?
diff between exptected result and requirement?
State two uses of pointers in C?
what does static variable mean?
What is the purpose of the preprocessor directive error?
Which of these functions is safer to use : fgets(), gets()? Why?
Write a program to check palindrome number in c programming?
what is a function method?give example?
What is the significance of c program algorithms?
Explain how do you convert strings to numbers in c?
Why do we use c for the speed of light?
Explain how can you check to see whether a symbol is defined?
What is the difference between the expression “++a” and “a++”?
What are logical errors and how does it differ from syntax errors?