#include
using namespace std;
int assign(int num){
if( num == 1){
return 2;
}
if( num == 2 ){
return 3;
}
return assign( num - 1) + assign( num -2);
}
int main() {
int n;
cin >> n;
int num;
for( int i = 0; i < n; i++){
cin >> num;
cout << β#β << num <<" : "<< assign(num) << endl;
}
return 0;
}
I am getting the right answer after successful compilation code but it is showing that testcases are failing
hi @akki56756_bab14f919dbad123
cout << β#β << num <<" : "<< assign(num) << endl;
here instead of printing num, print the iteration noβ¦
I have corrected your codeβ¦ its working fine nowβ>
yeah , its working fine
1 Like
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.