Where i am going wrong?

#include
using namespace std;
int main() {
int N;
cin>>N;
for(int i=1;i<N;i++){
int n1=0,n2=1,n3,i,number;
cin>>number;
cout<<n1<<" “<<n2<<” “;
for(i=2;i<number;++i)
{
n3=n1+n2;
cout<<n3<<” ";
n1=n2;
n2=n3;
}
}
return 0;
}

hello @anuragsen9617
ur approach is not correct.
u will be given input only once and then based on that input u need to print the series.
in ur code u were taking input for every row which is wrong.
also u were declaring two variables with same name, it is also wrong.
refer this code ->


and let me know if anything is not clear

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.