My code for single input is right. But for next term its wrong

My code : https://ide.codingblocks.com/s/651628

Hello @ayushkotwar2002_78a27ac2b05189a5,

Corrected Code:

decimal = 0;
i=1;
while(binary!=0){
rem = binary%10;
decimal = decimal + (remi);
i = i
2;
binary = binary/10;
}
cout<<decimal<<endl;

your errors:

  1. You need to cout ‘endl’ after printing decimal.
  2. For each test case, decimal and i should be reinitialized.

Thank you for the help sir. It solved my problem.

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.