U E D R , A S I H C RSS

피보나치/aekae

피보나치 수열

~cpp 
#include <iostream>
using namespace std;

int fivo(int);

int main()
{
	int input;
	cout << "입력 : ";
	cin >> input;
	cout << fivo(input) << endl;
	return 0;
}

int fivo(int i)
{
	if (i == 0)
		return 0;
	if (i == 1)
		return 1;
	return fivo(i-1) + fivo(i-2);
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 14.5463 sec