Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. static boolean palindrom_iter(int num){
  2. String binNum = "";
  3. while (num > 0) {
  4. binNum = ((num%2) == 0 ? "0" : "1") + num;
  5. num = num / 2;
  6. }
  7. System.out.println(binNum);
  8. return true;
  9. }
  10. public static void main(String[] args){
  11. int i = 8833;
  12. System.out.println(palindrom_iter(i));
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement