Palindrome Number



Java Program whether the number is Palindrome or not.

Implementation :-

import java.util.Scanner;
class Palindm
{
    public static void main(String[] args)
    {
        int rm, rv=0,act;
        System.out.println("Enter a number: ");
        Scanner s = new Scanner(System.in);
        int num = s.nextInt();
        act=num;
        while(num > 0)
        {
            rm = num%10;
            rv = rv*10 + rm;
            num = num/10;
        }
        if(rv==act)
        {
            System.out.println(act+" is a Palindrome Number.");
        }
        else
            System.out.println(act+" is not a Palindrome Number.");
    }
}


D:\AllPrograms\1232>javac Palindm.java

D:\AllPrograms\1232>java Palindm
Enter a number:
121
121 is a Palindrome Number.

D:\AllPrograms\1232>java Palindm
Enter a number:
432
432 is not a Palindrome Number.

D:\AllPrograms\1232>java Palindm
Enter a number:
65656
65656 is a Palindrome Number.

Comments

Popular posts from this blog

Understanding Activation Functions in Deep Learning and Machine Learning

Display Browser information using javascript

Understanding the Differences between POST, PUT, and PATCH in REST APIs