Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // HW
- import java.util.Scanner;
- public class ThreeDigitPalindrome {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- int num;
- System.out.print("Enter a number: ");
- num = in.nextInt();
- int ones = num % 10;
- int hundreds = num / 100;
- if(ones == hundreds)
- System.out.printf("%d is a palindrome", num);
- else
- System.out.printf("%d is not a palindrome", num);
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment