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 / 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


Please Help Members By Posting Answers For Below Questions

program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

2045


why return type of main is not necessary in linux

2043


What are bitwise shift operators in c programming?

1038


Can we use visual studio for c?

1009


Explain why can’t constant values be used to define an array’s initial size?

1305


How can I call fortran?

992


What is #line?

1005


Why do we use header files in c?

1019


What does %d do?

1205


What is an array? What the different types of arrays in c?

1104


Why is c faster?

1014


Why we use int main and void main?

1017


What the different types of arrays in c?

1022


What is the use of bitwise operator?

1068


What is the most efficient way to count the number of bits which are set in an integer?

1001