Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def decimal_to_binary(decimal):
- if decimal == 0:
- return 0
- elif decimal == 1:
- return 1
- else:
- remainder = decimal % 2
- return int(str(decimal_to_binary(decimal // 2)) + str(remainder))
- print(decimal_to_binary(4099))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement