+ 5

--> CHALLENGE <-- Binary

Write a program to get a number (even float and negative numbers!) in decimal, and return that in binary. If it was infinity, ask user the precision. for example: 10 --> 1010 -5 --> -101 2.5 --> 10.1 2.3 --> 10.01001... **All Languages**

29th Dec 2017, 8:03 AM
SMhd Asadi
SMhd Asadi - avatar
7 Answers
29th Dec 2017, 12:02 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
That's hard, especially with numbers that cannot be fully expressed as 1/2^n
29th Dec 2017, 9:01 AM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
+ 2
What is binary???
29th Dec 2017, 9:33 AM
Sid
Sid - avatar
+ 2
a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically 0 and 1. numbers like 110101 are binary numbers.
29th Dec 2017, 9:39 AM
SMhd Asadi
SMhd Asadi - avatar
+ 1
https://code.sololearn.com/c1ZXvj2XT0jm/?ref=app open on a computer to work correctly.
29th Dec 2017, 10:04 AM
SMhd Asadi
SMhd Asadi - avatar
29th Dec 2017, 6:22 PM
VcC
VcC - avatar