세번째,.

~cpp 
#include <iostream>
using namespace std;

int num(int);
void main()
{
	int in,out;
	cout<<"입력 : ";
	cin>>in;
	out=num(in);
	cout<<in<<"번째는 "<<out<<endl;

}

int num(int x)
{
	
	if(x>2) return num(x-1)+num(x-2);
	else return 1;
} 


Retrieved from http://wiki.zeropage.org/wiki.php/피보나치/문원명
last modified 2021-02-07 05:31:28