Question: Write a C++ program that reads a positive integer and prints all of its binary digits (in reverse order). Print the number % 2, then
Write a C++ program that reads a positive integer and prints all of its binary digits (in reverse order). Print the number % 2, then replace the number by number / 2. Keep going until the number is 0.
Validate the input. Do not accept a negative integer.
Sample run of program:
Enter a positive integer:
> -2
Invalid input! Try again:
> 20
Your number in binary in reverse order is:
0
0
1
0
1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
