Palindrome Number in C, Java, and Python
How to Determine?
A palindrome is a word, phrase, number, or sequence of characters that reads the same both forward and backward when reversed. Eg: dad, 101, etc.
Given a positive integer, the task is to determine whether the number is a palindrome or not.
1. Take user's input.
2. Declare a variable reverseNum=0.
3. Now, make a while loop until the original number > 0.
Algorithm to Check Palindrome Number
4. In every loop, get last digit of number and add that digit at end of reverseNum and then divide original number by 10.
reverseNum = reverseNum * 10 + (number % 10)
5. Lastly, check if original number = reverseNum.
How to implement this approach in different programming languages?