Computer Science QuestionWatch this thread
Write a programming code to find and print all Palindrome numbers between 1 to 3000.
Print 10 numbers in each line [do not forget to add space between numbers]. To find
a Palindrome number you MUST exactly follow the steps below:
1- For each number, first, calculate the number of digits; You can divide your integer
by 10 and use the integer quotient continuously until you reach zero.
2- Retrieve the first digit from right (last digit when you read your number from left);
you can use modulus operator (%), then make it raised to the correct power of length
e.g., for the first digit it will be raised to power of length minus one (or number of digits
minus one), for the second digit, use number of digits minus two and so on.
3- Repeat step 2, until you have retrieved all digits, then, produce the reverse number.
An example is provided here:
To reverse 125, you need to obtain the length which is 3.
5x103-1+2x103-2+1x103-3 = 521
Once you have calculated the reversed number compare it with the original one and
see whether a Palindrome number has been found.
Do NOT use list, string, list/string operations, any library or recursive function for this