answersLogoWhite

0


Best Answer

#include
#include

using std::cin;
using std::cout;
using std::endl;
using std::tolower;

long factorial(const int& N);

int main()
{
int N = 0; //factorial of N
char command = 'n';
do
{
cout << "Enter a number to calculate factorial: ";
cin >> N;

cout << endl << "Factorial of " << N << " is: " << factorial(N) << endl;

cout << "Do you want to continue (y/n)?";
cin >> command;
cout << endl;
} while ('y' == tolower(command));

system("PAUSE");
return 0;
}

long factorial(const int& N)
{
if (N == 0)
{
return 1;
}
else
{
return (N * factorial(N - 1));
}
}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to find n th fabonacci number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find out the number of calories in crisps?

look ont the back of th packet


A method you could use to find the 200 th even number?

The nth even number is 2n...


What is th abbreviation for mother on a church program?

Sis - Sister


How dis absolute monarchies change during the Th Th and Th centuries?

To answer this question we need the centuries. "Th" is not a word or number.


In th number 3024598136670 what is th place value of 1?

100000


What does the TH mean on vermont road signs?

TH = town highway, generally followed by a number, as in TH 25


How do you slove the median?

Line the numbers up from lowest to highest, and find the middle number. Let n be "how many numbers there are". To find the middle number, find the "(n+1)/2"th number. If this gives you a whole number, the median is the corresponding number in the number line. If "(n+1)/2" gives you a decimal, such as 21.5th number, you need to find the average between the 21st and 22nd number.


What is th number that is factor of every number?

One.


Th number from which another number is being subtracted?

difference


How do you find GCF and LCM?

To find the GCF and the LCM you have to first at least try to use prime factorization. So use factor trees. Or for the LCM find th least common multiples of the number.


What number has the prime factorization of 2 to the Th power and 4 to the Th power?

No number has that prime factorization since 4 isn't prime.


What is an Automatic number?

the number of pt,n,e- make each atom diff.oxygen as an example the number at th etop of an periodic table on th left is the atomatic # of protons.