Question: JAVA Write a program that asks the user for a positive integer n, and then convert the value of n to binary notation. - Allow
JAVA
Write a program that asks the user for a positive integer n, and then convert the value of n to binary notation.
- Allow the user to perform repeated conversions in a single execution.
- For conversions use repeated division by 2 on the n until it reaches 0.
e.g
n=10
10/2 = 5 remainder is 0, multiply by 1
5/2 = 2 remainder is 1, multiply by 10
2/2 = 1 remainder is 0, multiply by 100
1/2 = 0 remainder is 1, multiply by 1000
Thank you!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
