My code : https://ide.codingblocks.com/s/651628
My code for single input is right. But for next term its wrong
Hello @ayushkotwar2002_78a27ac2b05189a5,
Corrected Code:
decimal = 0;
i=1;
while(binary!=0){
rem = binary%10;
decimal = decimal + (remi);
i = i2;
binary = binary/10;
}
cout<<decimal<<endl;
your errors:
- You need to cout ‘endl’ after printing decimal.
- 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.