Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program that finds the factorial of a number using
recursion?

Answer Posted / anandi

#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 ?    197 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why malloc is faster than calloc?

1026


Tell us the use of fflush() function in c language?

1107


Subtract Two Number Without Using Subtraction Operator

797


What is modeling?

1007


What is a pointer value and address in c?

1076


What are the different types of pointers used in c language?

1010


How can I pad a string to a known length?

988


if p is a string contained in a string?

1805


Do you know the difference between exit() and _exit() function in c?

1027


Why is c called c not d or e?

1059


What does int main () mean?

969


Why clrscr is used in c?

964


find the sum of two matrices and WAP for it.

1082


What is the use of #include in c?

1047


Explain what is the benefit of using an enum rather than a #define constant?

1186