121k views
4 votes
Write a program binary.cpp that reads a positive integer and prints all of its binary digits.

User Yasitha
by
3.8k points

1 Answer

3 votes

Answer:

View image below.

Step-by-step explanation:

They're just asking you to create a num2bin function on Cpp.

If you search for "num2bin in C", you can find a bunch of answers for this if you think my solution is too confusing.

One way to do it is the way I did it in the picture.

Just copy that function and use it in your program. The rest you can do yourself.

Write a program binary.cpp that reads a positive integer and prints all of its binary-example-1
User Suna
by
4.7k points