The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


some help please

Posted by andre on October 19, 2001 at 10:18 PM

if someone could help with the following it would be greatly appreaciated, problem:
Write program that allows the user to input a non-negative decimal integer and then displays that value in binary. For example if the user inputs ``13'' the program should output ``1101''.

Hint: The program should use this strategy:

Divide the decimal number by 2, keeping the quotient and the remainder (which will be either 0 or 1).
Prepend the remainder to a string
Keep dividing and prepending the remainder to the string until the quotient is zero.

  • Try this code Jinaraj October 29, 2001 at 6:32 AM (0)
  • *sigh* Chin Loong October 20, 2001 at 9:21 AM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us