IS PALINDROME NUMBER OR NOT?
This is simple java program that will check that whether entered number is PALINDROME or not . Palindrome number means if we reverse any number and then we got same number again then we say inputted number is PALINDROME number.
JAVA code :)
import java.util.Scanner;
public class Palindrome
{
public static void main(String[] args)
{
int n,revnum=0,m,rem;
Scanner sc=new Scanner(System.in);
System.out.println("Enter any number: ");
n=sc.nextInt();
sc.close();
m=n;
while(n>0)
{
rem=n%10;
revnum=revnum*10+rem;
n=n/10;
}
if(revnum==m)
{
System.out.println(+m+" is Palindrome Number.");
}
else
{
System.out.println(+m+" is not Palindrome Number.");
}
}
}
0 Comments