This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programming Diversions and the fly likes Palindromic Number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Palindromic Number" Watch "Palindromic Number" New topic

Palindromic Number

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Finding the word whether its Palindromic had been discussed in the past.How about numbers? and that without using String or character array?I wrote a program but its rather brut force.i.e. comparing quotient with remainder and reducing the number and repeating till middle one.
Any other better approach?

Marcel de Jong
Ranch Hand

Joined: May 27, 2002
Posts: 54
Hi Capablanca,
how about reducing the original number with it reverse? This should always result in zero (0). If not, you don't have a palindrome.
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
I think this will increase one additional step.bcos brut force,we are doing the same thing.
Nick George
Ranch Hand

Joined: Nov 17, 2003
Posts: 38
you could always cheat...
String s=(new Integer(1881)).toString();
subject: Palindromic Number
Similar Threads
tiger 1.5 study resources
Quck one for a Friday afternoon.
Nested for loop
Wondering if someone can help me out