Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Chapter 5 Problem 37 (Decimal to Binary) Write a program that prompts the user to enter a decimal integer and displays its corresponding binary value.
Chapter 5 Problem 37 (Decimal to Binary)
Write a program that prompts the user to enter a decimal integer and displays its corresponding binary value. Don't use Java's Integer. toBinaryString(int) in this program. Hint: Program Plan. 1) Enter a decimal integer number. Do NOT use
public static StringBuffer toBinary(int number) { StringBuffer sb = new StringBuffer(); int t=0; while(number>0) { t = number%2; sb.append(t); number = number / 2; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started