Question: Write a Java or C/C++ program to convert a base-10 number to a base-2 number. The following input should be tested: Logic should split the

Write a Java or C/C++ program to convert a base-10 number to a base-2 number. The following input should be tested:

Logic should split the number into integer and float then divide by 2 for the int concatenating into a string of 10000000 with the final remainder being 1 concatenated to the front. The float would be multiplied by 2 then 1 would be subtracted until you get 0. The two strings would be concatenated at the end to form something like 10000.000001.

1) 12 2) 12.6875

3) .6875

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 Databases Questions!