U E D R , A S I H C RSS

피보나치/문원명

세번째,.

~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;
} 

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:28
Processing time 0.0170 sec