Infinite loop problem

My code is workin fine in offline ide but here it’s going in infinite loop.
#include
using namespace std;

int main() {
int t;
cin>>t;
int n;
int j=1;
int sum=0;
while(t–)
{
sum=0;
j=1;
cin>>n;
while(n!=0)
{

	int k=n%10;
	if(k==1)
	{
		sum=sum+j;

	}
	n=n/10;
	j=j*2;
}
cout<<sum<<endl;

}

return 0;

}

Hello @nitesh16,

Share your code using an Online IDE.
The way you have shared it has introduced many syntax errors to it.

Mistake:
the datatype of n is int.
But, the constraints read that Digits in binary representation is <=16.
So, how would you accommodate 16 digit long number in variable of type int.

Moreover, your submissions shows that you have scored 100 marks.
So, i don’t know which code i have to look into.

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.