PCLP2/lab07/01.cpp
Fándly Gergő 4a6331088a chore: Lab07
2020-05-01 17:58:05 +03:00

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