Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 month ago

Java Homework Assignment?

How do you write a program in Java that prints all of the integers between 10000 and 16000 that are the same number when the digits in the number are reversed?

2 Answers

Relevance
  • 1 month ago
    Favorite Answer

    1) Create a loop that hits every integer between the two values

    2) For each iteration in the loop, have a routine that checks of the number is a palindrome

    3) if it is, output the number.  If it isn't, do nothing and end the loop.

  • EddieJ
    Lv 7
    1 month ago

    Well, you start by determining if ONE number is the same when reversed.

    You have to decide if you are to do it mathematically or if you want to convert the integer to a string and see if it's a palindrome.  Have you already dealt with palindromes?

Still have questions? Get your answers by asking now.