1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* Write a program to find whether no. is palindrome or not. Example : Input - 12521 is a palindrome no. Input - 12345 is not a palindrome no. */ class Palindrome{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int n = num; //used at last time check int reverse=0,remainder; while(num > 0){ remainder = num % 10; reverse = reverse * 10 + remainder; num = num / 10; } if(reverse == n) System.out.println(n+" is a Palindrome Number"); else System.out.println(n+" is not a Palindrome Number"); } } |
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com
Thanks…it is a very helpful to me…thnks a lot
where it get input for number sir
Thank u very much.
thank u ….
Here is another way to check palindrome in Java
its superb
Plz dont post adds on main content.
It is too worse….
Thanks
Also refer this for PALINDROME OF A NUMBER AND A STRING IN SAME USER INPUT
http://knowitenjoyit.blogspot.in/2013/03/palindrome-number-string-java.html