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
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Why is sprintf unsafe?
how to make a scientific calculater ?
Explain the advantages and disadvantages of macros.
What is a constant?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
What is scanf () in c?
What are all different types of pointers in c?
Write program to remove duplicate in an array?
How old is c programming language?
What is a nested loop?
Differentiate between declaring a variable and defining a variable?
What is the 'named constructor idiom'?
State the difference between realloc and free.
Explain enumerated types in c language?