Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: How to find whether a number is palindrome or not?

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How to find whether a number is palindrome or not?

    Can any one provide the simplest code to check whether a number is palindrome or not?


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,357
    My Mood
    Hungover
    Thanks
    144
    Thanked 626 Times in 537 Posts

    Default Re: How to find whether a number is palindrome or not?

    No. We aren't going to do your homework for you.

    Please post the code you have so far, in the form of an MCVE, as well as exactly what you're stuck on, and we'll go from there.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to find whether a number is palindrome or not?

    ...spoonfeeding removed...
    Last edited by copeg; August 6th, 2014 at 05:28 PM. Reason: removed spoonfeeding

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,301
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: How to find whether a number is palindrome or not?

    @Azizur, welcome to the forums. Please read:
    Forum Guidelines
    The Problem with Spoon-feeding

  5. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: How to find whether a number is palindrome or not?

    Same way as a String.
    Improving the world one idiot at a time!

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,357
    My Mood
    Hungover
    Thanks
    144
    Thanked 626 Times in 537 Posts

    Default Re: How to find whether a number is palindrome or not?

    Quote Originally Posted by Junky View Post
    Same way as a String.
    That's one way, but it certainly isn't the only way. I wouldn't be surprised if the homework stipulated that you can't use Strings.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: How to find whether a number is palindrome or not?

    I didn't mean to suggest to use Strings, I was being flippant and meant you check the character/digit at the front and make sure it is the same same as the char/digit at the back. If they are then look at the second and second last char/digit etc.
    Improving the world one idiot at a time!

Similar Threads

  1. How to find the nth number?
    By desiVirus in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 30th, 2013, 06:18 AM
  2. Need help determining if number is a palindrome using an array!
    By jetset222 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 28th, 2013, 09:09 PM
  3. Find the two largest number
    By vendettabf in forum What's Wrong With My Code?
    Replies: 15
    Last Post: December 29th, 2011, 12:23 PM
  4. Replies: 4
    Last Post: June 10th, 2009, 01:04 AM
  5. Generation of Palindrome number in Java
    By tina.goyal in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 26th, 2009, 08:49 AM