Notifications
Sandbox

+1
−0

# Challenge

What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an int then turn it into it's binary value.

• Take input of a non-negative decimal integer and output its binary value/form.
• Any preceding zeros don't need to be outputted.
• Suggested by @celtschk: Converters that simply take the inputted number as binary without changing the input itself aren't allowed. (Won't be in the final draft)
• Adding to the disallowed converters, any built-in method that formats the variable as binary without actual conversion like Python's 0b are also not allowed. The focus is to take input, make a converter, then output the result. (Won't be in the final draft)
• This is code-golf, so the shortest program wins. Yep, not by language.

# Test Cases

n = 0
Output: 0

n = 1
Output: 1

n = 5
Output: 101

n = 12
Output: 1100

n = 31
Output: 11111

n = 4096
Output: 1000000000000

Why does this post require moderator attention?
You might want to add some details to your flag.

#### 7 comment threads

Built-ins (2 comments)
Specify decimal base (1 comment)
This is not encryption (1 comment)
What about negative integers? (3 comments)
Featured
Hot Posts
Challenges — "Hello, World!"
Challenges — Cumulative Counts
Challenges — Looping counter

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us!