fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n,rem,sum=0,t;
  13. Scanner sc=new Scanner(System.in);
  14. n=sc.nextInt();
  15. t=n;
  16. while(n>0)
  17. {
  18. rem=n%10;
  19. sum=sum*10+rem;
  20. n=n/10;
  21. }
  22. n=t;
  23. if(sum==n)
  24. {
  25. System.out.println(sum+" is palindrom");
  26. }
  27. else
  28. {
  29. System.out.println(sum+" is not a palindrom");
  30. }
  31. }
  32. }
Success #stdin #stdout 0.06s 2184192KB
stdin
524
stdout
425 is not a palindrom