Question: My code does not work, I need to be able to enter binary and convert it into decimal n C++. Please use these function only

My code does not work, I need to be able to enter binary and convert it into decimal n C++. Please use these function only : printf, scanf, if, else and for library only # and #.

My code does not work, I need to be able to enterbinary and convert it into decimal n C++. Please use these function

#include #include int main( ) { int binary, semi_binary, binary_digit, decimal = 0; printf("Input binary digit: "); scanf ("%d", &binary); binary_digit= binary; // if number is not 0 or 1, then number is not valid if(binary! = 0 | | 1) print ("\ This is not valid number ) ) scanf ("%d", &binary) // if number is 0 or 1, then number is valid else { (int i = 0; binary != 0; i++, binary /= 10) semi_binary = binary % 10; decimal += semi_binary * pow(2, i); } printf("Your decimal after conversion from binary: %d\ ", decimal); resturn 0; return 0}DEV C+ Embarcadero Dev-C+ + 6.3 File Edit Search View Project Execute Tools AStyle Wi Project Clas DEV C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!