Write a java Program to check the given number is Palindrome or not

Write a java Program to check the given number is Palindrome or not

Write a java Program to check the given number is Palindrome or not

Program
import java.util.*;
public class Main 
{
    public static void main(String[] args) 
    {
        int n;
        Scanner s=new Scanner(System.in);
        System.out.println("Enter a number: ");
        n=s.nextInt();
        int palindrome,r,rev=0;
        palindrome = n;
        while (n > 0) 
        {
            r = n % 10; 
            rev = rev * 10 + r;
            n = n / 10;
        }
        if (rev == palindrome) 
        {
            System.out.println(" The given no is palindrome "+ rev);
        } 
        else 
        {
            System.out.println("The given no is not palindrome " + rev); 
        }
    }
}


Output:

Enter a number: 212
The given no is palindrome 212

Enter a number: 1228
The given no is not palindrome 8221



More Questions


34 . Write a java Program to Print given number in words
35 . Write a java Program to check the given number is Palindrome or not
36 . Write a java Program to print palindrome number upto N numbers
37 . Write a java Program to print N prime numbers and find sum and average
38 . Write a Java Program to find largest number in an array
39 . Write a Program to find second largest number in an array
40 . Write a Program to Find largest and smallest number in an array in java
41 . Write a Java Program to find largest and second largest in an array
42 . Write a java program to find the index of the largest number in an array
43 . Write a java program to Find the index of the smallest number in an array
44 . Write a Program to remove duplicate element in an array



For latest job updates join Telegram Channel: https://t.me/sateeshm

Apply For The Job

Apply For Job

Java Material

Python Material

PLSQL Material

.Net Material

Java Practice Programs

400 Java Programs