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

#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 ?    17 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a factorial program using C.

1122


What is sizeof int?

1153


How can I swap two values without using a temporary?

1155


Explain data types & how many data types supported by c?

1134


What is oops c?

1342


Explain the Difference between the New and Malloc keyword.

1189


Explain how do you convert strings to numbers in c?

1126


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

1171


Explain what is the use of a semicolon (;) at the end of every program statement?

1262


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1410


What are the types of pointers in c?

1080


What are different types of variables in c?

1127


What are linker error?

1150


can anyone please tell about the nested interrupts?

2183


What will the preprocessor do for a program?

1117