Example 67: Decimal to Binary Conversion
Learn how to convert a decimal number into its binary equivalent.
We'll cover the following...
We'll cover the following...
Problem
Write a function that takes a positive decimal integer as a parameter and prints its binary equivalent on the console. Also, check for negative input and return 0 in such a case.
Example
| Input | Outputin |
|---|---|
| -15 | 0 |
| 10 | 1010 |
| 45 | 101101 |