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 2021-02-07 05:31:29
Processing time 0.0189 sec