Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.ukr.shyevhen;
- import java.util.Scanner;
- public class HomeWorkL2E4 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int num;
- int a;
- int b;
- int c;
- int d;
- int e;
- int f;
- System.out.print("Enter the number: ");
- num = sc.nextInt();
- a = num / 100000;
- b = num % 100000 / 10000;
- c = num % 10000 / 1000;
- d = num % 1000 / 100;
- e = num % 100 / 10;
- f = num % 10;
- if (a == f && b == e && c == d) {
- System.out.println("This number is a palindrom.");
- } else {
- System.out.println("This number isn't a palindrom.");
- }
- }
- }
Add Comment
Please, Sign In to add comment