Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

decimal to binary

def dec2bin_recurs(n: int) -> int:
    assert n >= 0 and isinstance(n, int), "Input must be positive integer"
    if not n: return n
    return int(f'{dec2bin_recurs(n//2)}{n%2}')
 
PREVIOUS NEXT
Tagged: #decimal #binary
ADD COMMENT
Topic
Name
1+6 =