write a program that finds the factorial of a number using
recursion?
Answer Posted / bhargav
#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 ? | 13 Yes | 4 No |
Post New Answer View All Answers
#include
Is struct oop?
hi any body pls give me company name interview conduct "c" language only
Differentiate between functions getch() and getche().
Difference between MAC vs. IP Addressing
about c language
Is there any demerits of using pointer?
What are extern variables in c?
What are disadvantages of C language.
Are pointers really faster than arrays?
plz let me know how to become a telecom protocol tester. thank you.
How can you avoid including a header more than once?
what is event driven software and what is procedural driven software?
What do you mean by a sequential access file?
What are the 4 types of unions?