Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bluucat;
- public class bluupalindromeonline {
- public static void main(String[] args) {
- }
- public static boolean isPalindrome(int n) {
- System.out.println("What number do you wanna check?");
- // Scanner input = new Scanner(System.in);
- int remainder, sum = 0, temp;
- // n = input.nextInt();
- // input.nextLine();
- temp = n;
- while (n > 0) {
- remainder = n % 10;
- sum = (sum * 10) + remainder;
- n = n / 10;
- }
- if (temp == sum) {
- System.out.println("number is palindrome");
- return true;
- } else {
- System.out.println("number not palindrome");
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement