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

#include<iostream.h>
#include<conio.h>
void main()
{
int n,fact;
int rec(int); clrscr();
cout<<"Enter the number:->";
cin>>n;
fact=rec(n);
cout<<endl<<"Factorial Result are:: "<<fact<<endl;
getch();
}
rec(int x)
{
int f;
if(x==1)
return(x);
else
{
f=x*rec(x-1);
return(f);
}
}

Is This Answer Correct ?    14 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are multidimensional arrays?

1175


what is the difference between 123 and 0123 in c?

1277


What does volatile do?

1040


Explain the use of 'auto' keyword in c programming?

1185


What does printf does?

1322


what is bit rate & baud rate? plz give wave forms

2028


In which layer of the network datastructure format change is done

1944


What is the difference between exit() and _exit() function?

1102


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1330


What are the types of functions in c?

1039


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1149


Is there any demerits of using pointer?

1120


hi any body pls give me company name interview conduct "c" language only

2324


Can we change the value of static variable in c?

1078


What does the error 'Null Pointer Assignment' mean and what causes this error?

1260