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

#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 ?    62 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c high or low level?

1056


What is the scope of an external variable in c?

1097


Can you define which header file to include at compile time?

1076


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2697


Can a program have two main functions?

1181


What is the right type to use for boolean values in c?

1091


What are the c keywords?

1260


What does dm mean sexually?

1386


What is binary tree in c?

1138


What is a ternary operator in c?

1180


How do I determine whether a character is numeric, alphabetic, and so on?

1188


What does the file stdio.h contain?

1120


List the different types of c tokens?

1123


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1265


What is type qualifiers?

1193