Question: write a Java program that prompts the user to enter a positive decimal number, converts and displays the binary equivalent. The program should contain a
write a Java program that prompts the user to enter a positive decimal number, converts and displays the binary equivalent. The program should contain a recursive method called dec2bin that takes an integer as parameter and returns the binary number as a String.
run DecimalToBinarv Enter decimal number The number 4 in decimal is 100 in binary > run DecimalToBinary Enter decimal number 4 2 The number 2 in decimal is 10 in binary. > run DecimalToBinary Enter dlecimal numbe r The number 3 in decimal is 11 in binary run DecimalToBinary Enter decimal number The number 15 in decimal is 1111 in binary 15 run DecimalToBinary Enter decimal number The number 26 in decimal is 11010 in binary 26
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
