Kindly correct mistake in this

maybe see here where im going wrong in this

hi @uditmudgal07_2f40cca755bd8bd2 no of test cases
refer

#include <iostream>

using namespace std;
int bintodec(int nos){
    int base = 1;
	int decval =0;
	while(nos){
		int lastdig = nos%10;
		nos=nos/10;
		decval+= lastdig*base;
		base*=2;
	}
	return decval;
    
}
int main(){
    int N,nos;
    cin>>N;
    for (int i = 1;i<=N;i++){
        cin>>nos;
    	cout<<bintodec(nos)<<endl;
    }
}

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.