import java.util.*; class Example { public static void main(String[] args) { int n,rev=0; int num; int x; Scanner s=new Scanner(System.in); System.out.println("enter the number"); n=s.nextInt(); x=n; while(n!=0) { num=n%10; rev=rev*10+num; n=n/10; } System.out.println("the reverse is"+" "+rev); if(x==rev) { System.out.println("number is palindrome"); } else { System.out.println("number is not palindrome"); } } }
Output
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc