Decimal to Binary
Problem 3
Problem Statment
Given a decimal number, convert it to its binary representation.
Input Format:
-
The first line contains an integer, T, representing the number of test cases (1 <= T <= 9).
-
Each test case contains a single positive integer, N, on a new line (1 <= N <= 109).
Output Format:
- For each test case, print the binary representation of the corresponding decimal number N on a new line.
Constraints:
- 1 <= T <= 9
- 1 <= N <= 109 (one billion)
Sample Input
Sample Output
Solution
decimal_to_binary.py
for _ in range(int(input())):
n = int(input())
print(bin(n)[2:])