Guest User

Untitled

a guest
Oct 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import java.util.Scanner;
  2. class Palindrome {
  3. public static void main(String[] args) {
  4. int a,no,b,temp=0;
  5. Scanner s=new Scanner(System.in);
  6. System.out.println("Enter any num: ");
  7. no=s.nextInt();
  8. b=no;
  9. while(no>0)
  10. {
  11. a=no%10;
  12. no=no/10;
  13. temp=temp*10+a;
  14. }
  15. if(temp==b)
  16. {
  17. System.out.println("Palindrome");
  18. }
  19. else
  20. {
  21. System.out.println("not Palindrome");
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment