Guest User

Untitled

a guest
Mar 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package net.ukr.shyevhen;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class HomeWorkL2E4 {
  6.  
  7. public static void main(String[] args) {
  8. Scanner sc = new Scanner(System.in);
  9. int num;
  10. int a;
  11. int b;
  12. int c;
  13. int d;
  14. int e;
  15. int f;
  16. System.out.print("Enter the number: ");
  17.  
  18. num = sc.nextInt();
  19. a = num / 100000;
  20. b = num % 100000 / 10000;
  21. c = num % 10000 / 1000;
  22. d = num % 1000 / 100;
  23. e = num % 100 / 10;
  24. f = num % 10;
  25. if (a == f && b == e && c == d) {
  26. System.out.println("This number is a palindrom.");
  27. } else {
  28. System.out.println("This number isn't a palindrom.");
  29. }
  30.  
  31. }
  32.  
  33. }
Add Comment
Please, Sign In to add comment