write a program that finds the factorial of a number using
recursion?
Answer Posted / abhinandan
#include<stdio.h>
main()
{
int a, fact;
printf("\nEnter any number: ");
scanf ("%d", &a);
fact=rec (a);
printf("\nFactorial Value = %d", fact);
}
rec (int x)
{
int f;
if (x==1)
return (1);
else
f=x*rec(x-1);
return (f);
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is a void * in c?
What is fflush() function?
Does c have circular shift operators?
write a progrmm in c language take user interface generate table using for loop?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What is a dynamic array in c?
Can you please explain the difference between malloc() and calloc() function?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
Can you pass an entire structure to functions?
Is null equal to 0 in sql?
Are pointers integers in c?
List a few unconditional control statement in c.
Do pointers store the address of value or the actual value of a variable?
Explain the difference between ++u and u++?
Explain how can type-insensitive macros be created?