Question: An algorithm called Divide by 2 can be used to convert a decimal number to its binary number equivalent. The algorithm assumes that we start
An algorithm called Divide by 2 can be used to convert a decimal number to its binary number equivalent. The algorithm assumes that we start with a positive integer n. A simple iteration then continually divides the decimal number by 2 and keeps track of the remainder by using a stack. Please write a java method to implement the algorithm and display the binary number (15 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
