0

How to ask the user to prompt binary numbers as strings??

i need to create a program that gives base 3 equivalent to base 10. I the program almost done. until I noticed that I had to ask the user to prompt the binary numbers as strings.

23rd Feb 2017, 9:39 AM
Alejandra Ackers
Alejandra Ackers - avatar
2 Answers
0
The user always prompts a string. When you read the input in your program you should think what type of input you expect. If you want the binary number to be a string just read it like a string, not as a number.
23rd Feb 2017, 11:12 AM
bogdan
bogdan - avatar
0
You can try printBin(input.nextInt());
24th Feb 2017, 6:22 AM
Sam