Practice

8-Bit Binary Converter

2025/Oct/Nov·Variant 3
MEDIUMAlgorithms

Convert a positive denary (base-10) integer into an 8-bit binary string.

Input: A whole number between 1 and 255 inclusive. Output: An 8-character string representing the binary equivalent (with leading zeros).

Example:

Input:  127
Output: 01111111
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Max value starting with 0
Inputs: 127
Expected: 01111111
Test 2: All ones
Inputs: 255
Expected: 11111111
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade