Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem4
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- int numberDecimal = in.nextInt();
- StringBuilder binary = new StringBuilder();
- while (numberDecimal > 0) {
- binary.append(numberDecimal % 2);
- numberDecimal = numberDecimal / 2;
- }
- System.out.print(binary.reverse());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement