convert the following decimals numbers to 10 bit binary (a) 37.31 (b) 6.215 (c) 33.333 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

convert the following decimals numbers to 10 bit binary (a) 37.31 (b) 6.215 (c) 33.333

chapter data representation

12th Nov 2016, 4:27 PM
burhanuddin
burhanuddin - avatar
2 Answers
- 1
I think in C++ you could create a float variable and cast the pointer to it to int. That way you'd get the decimal representation of it. Then you just have to convert from decimal to binary.
3rd Jun 2017, 8:21 PM
Tom Cox
Tom Cox - avatar
- 2
For Java it would be Integer.toBinary(number, numberOfBits); Better check StackOverflow.com for this
14th Nov 2016, 10:59 PM
Arsal Ali
Arsal Ali - avatar