Proszę o pomoc. Program musi działąć w C++.
#include <iostream>
using namespace std;
int ciag(int l){ if(l == 0) return 0; if(l == 1||l == 2) return 1; return ciag(l-1)+ciag(l-2);}
int main(){ int a; cin >> a; cout << ciag(a);
}
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
#include <iostream>
using namespace std;
int ciag(int l)
{
if(l == 0) return 0;
if(l == 1||l == 2) return 1;
return ciag(l-1)+ciag(l-2);
}
int main(){
int a;
cin >> a;
cout << ciag(a);
}