#include <iostream>
using namespace std;
int binToDecimal(int binNum){
int ans=0,pow=1;
while(binNum>0){
int rem=binNum % 10;
ans+= rem*pow;
binNum /=10;
pow*=2;
}
return ans;//decimal form
}
int main() {
cout << binToDecimal(101100) << endl;
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: