Example 67: Decimal to Binary Conversion
Explore how to convert a positive decimal number to its binary equivalent in C using arrays. Learn to validate inputs and handle the binary conversion process by collecting remainders in an array and reversing their order for output.
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 |
|---|