23 lines
250 B
C++
23 lines
250 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
int fib(int n){
|
|
if(n <= 1){
|
|
return n;
|
|
}
|
|
return fib(n-1) + fib(n-2);
|
|
}
|
|
|
|
int main(){
|
|
int n;
|
|
cout<<"N = ";
|
|
cin>>n;
|
|
|
|
for(int i=0; i<n; i++){
|
|
cout<<fib(i)<<", ";
|
|
}
|
|
cout<<"\b\b "<<endl;
|
|
|
|
return 0;
|
|
}
|