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. // your code goes here
  13. System.out.println("Enter a no::" );
  14. Scanner sc=new Scanner(System.in);
  15. int a=sc.nextInt();
  16. int org=a;
  17. int rem=0;
  18. int rev=0;
  19. while(a>0)
  20. {
  21. rem=a%10;
  22. rev=rev*10+rem;
  23. a=a/10;
  24. }
  25. if(rev==org)
  26. System.out.println("OK");
  27. else
  28. System.out.println("No");
  29. sc.close();
  30. }
  31. }
Success #stdin #stdout 0.06s 4386816KB
stdin
131
stdout
Enter a no::
OK