Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static boolean palindrom_iter(int num){
- String binNum = "";
- while (num > 0) {
- binNum = ((num%2) == 0 ? "0" : "1") + num;
- num = num / 2;
- }
- System.out.println(binNum);
- return true;
- }
- public static void main(String[] args){
- int i = 8833;
- System.out.println(palindrom_iter(i));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement