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

//*write a c program to calculate factorial by using
recursion*//
#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 ?    10 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it better to bitshift a value than to multiply by 2?

1050


What is the purpose of type declarations?

1077


What is the difference between new and malloc functions?

1052


What is keyword in c?

962


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1147


What is else if ladder?

965


What are extern variables in c?

950


How to create struct variables?

1045


what is the format specifier for printing a pointer value?

971


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1527


Is there any demerits of using pointer?

1015


What is pass by reference in c?

1146


write an algorithm to display a square matrix.

2640


What are shell structures used for?

984


What are the loops in c?

943