write a program that finds the factorial of a number using
recursion?
Answer Posted / sibnath halder
//*write a c program to calculate factorial by using
recursion*//
#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 ? | 10 Yes | 5 No |
Post New Answer View All Answers
What is variables in c?
Explain how do you override a defined macro?
what are the facialities provided by you after the selection of the student.
When is a void pointer used?
What is a #include preprocessor?
Differentiate between declaring a variable and defining a variable?
Explain low-order bytes.
Can you write the algorithm for Queue?
What is structure packing in c?
Is register a keyword in c?
What is type qualifiers?
What is character constants?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
When should the volatile modifier be used?
What is a void pointer? When is a void pointer used?