Programming Code Center(PCC)
[JAVA]

(PCC)::[How-to-write-Java-Program-to-Check-Whether-a-Number-is-Palindrome-or-Not]::[java]

File Name : Palindrome.java

//Example : Program to Check Palindrome using while loop
public class Palindrome {

    public static void main(String[] args) {

        int num = 121, reversedInteger = 0, remainder, originalInteger;

        originalInteger = num;

        // reversed integer is stored in variable 
        while( num != 0 )
        {
            remainder = num % 10;
            reversedInteger = reversedInteger * 10 + remainder;
            num  /= 10;
        }

        // palindrome if orignalInteger and reversedInteger are equal
        if (originalInteger == reversedInteger)
            System.out.println(originalInteger + " is a palindrome.");
        else
            System.out.println(originalInteger + " is not a palindrome.");
    }
}

Output :

Palindrome.jpg