X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Decimal to binary
Basic Accuracy: 70.8% Submissions: 3353 Points: 1

Given a decimal number N, compute its binary equivalent.

Example 1:

Input: N = 7
Output: 111

 

Example 2:

Input: N = 33
Output: 100001

Your Task:
You don't need to read input or print anything. Complete the function toBinary() which takes the decimal number N as the input parameter and prints its binary equivalent.
Note: Print the output in a single line, the next line character is printed by the Driver Code.

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Decimal to binary

Output Window