Where i am doing mistrake please tell me

#include
using namespace std;
int main() {
int n;
int no;
int base=1,bin=0;
// int bin=0;
int rem;
cin>>n;
// cin>>no;
while(n–)
{
cin>>no;
while(no!=0)
{
rem=no%10;
bin=bin+rembase;
no=no/10;
base=base
2;
}

cout<<bin<<endl;

}
//  cout<<bin<<endl;
return 0;

}

@itsmazhar7,
your code is correct just define base = 1, bin = 0. inside while loop for each new number they need to reinitialize

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.

there is another doubt …yess the question is resolved /…please look to another doubt

@itsmazhar7,
that doubt will be addressed separately please mark this one as resolved