U E D R , A S I H C RSS

피보나치/김상윤

~cpp 
#include <iostream>  
using namespace std;  
int pivona(int x);  
int main()  
{  
        int input; 
        cout << "수를 입력하시오:"; 
        cin >> input; 
        cout << pivona(input); 
        cout << endl; 
        return 0; 
} 
int pivona(int x) 
{ 
        if(x==0) 
                return 0; 
        if(x==1) 
                return 1; 
        return pivona(x-2) + pivona(x-1); 
} 

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