#include <iostream.h>

int pi(int a);

int main()
{
	int a,result;

	while (cin >> a)
	{
	
	result = pi(a);

	cout << a << "번째 값은 = " << result << endl;
	}
	return 0;
}

int pi(int a)
{
	if (a == 1)
		return 1;
	
	if (a == 2)
		return 2;

	else
		return pi(a-1) + pi(a-2);
}




Retrieved from http://wiki.zeropage.org/wiki.php/피보나치/장창재
last modified 2021-02-07 05:31:28