Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DPM;
- import java.util.*;
- public class Main {
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- int num = scan.nextInt();
- if (num == 0){
- System.out.println(0);
- return;
- }
- Deque<Integer> stack = new ArrayDeque<>();
- while (num !=0){
- stack.push(num % 2);
- num /= 2;
- }
- for (Integer integer : stack) {
- System.out.print(stack.pop());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement