This code is run in Sublime editor but when i submit it there it shows test cases failed.
#include
using namespace std;
int binary_to_decimal(int n)
{
int ans=0;
int rem=0,pow=1;
while(n>0){
rem=n%10;
ans+=rem*pow;
pow*=2;
n/=10;
}
return ans;
}
int main()
{
int n;
cin>>n;
while(n–){
int no;
cin>>no;
cout<<binary_to_decimal(no)<<endl;
}
return 0;
}
