package javaapplication1;
import java.util.*;
public class PalindromeNumber {
public static void main(String[] args){
int num,rev=0;
int dig;
Scanner in=new Scanner(System.in);
System.out.println("Enter a number to check if it is an palindrome number");
num=in.nextInt();
while(num!=0){
dig = num % 10;
rev = rev * 10 + dig;
num = num / 10;
}
if(num==rev){
System.out.println("palindrome number");
}else{
System.out.println(" not palindrome number");
}
}
}
0 comments:
Post a Comment