SHARE
TWEET

Untitled

a guest Feb 19th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Problem4
  4. {
  5.   public static void main(String[] args)
  6.   {
  7.     Scanner in = new Scanner(System.in);
  8.     int numberDecimal = in.nextInt();
  9.  
  10.     StringBuilder binary = new StringBuilder();
  11.  
  12.  
  13.     while (numberDecimal > 0) {
  14.       binary.append(numberDecimal % 2);
  15.       numberDecimal = numberDecimal / 2;
  16.     }
  17.     System.out.print(binary.reverse());
  18.   }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top