#K16216. Integer to Binary Conversion
Integer to Binary Conversion
Integer to Binary Conversion
Given an integer n, your task is to convert it to its binary representation as a string without using any built-in conversion functions. For example, if n is 13, you should output 1101
.
Note:
- If n is 0, output
0
. - If n is null (or its equivalent) or negative, output an empty string.
The binary conversion must be implemented manually using basic arithmetic operations.
inputFormat
The input is provided via standard input and consists of a single line containing an integer n.
outputFormat
Output the binary representation of n as a string following the rules mentioned above. If n is negative or null, output an empty string.
## sample0
0
</p>