0
How to check the palyndromic condition of a number?
It's been a couple of days which I've been wandering of finding a way to check if a num is a palindrome one? But never succeeded 😕 Would u plz give me a favor by taking ur time to guide me? Tnx u advancly..
3 Antworten
+ 6
https://www.sololearn.com/discuss/2158336/?ref=app
https://www.sololearn.com/discuss/80211/?ref=app
https://www.sololearn.com/discuss/80210/?ref=app
https://www.sololearn.com/discuss/1338023/?ref=app
https://www.sololearn.com/discuss/1061097/?ref=app
https://www.sololearn.com/discuss/554338/?ref=app
https://www.sololearn.com/discuss/1047573/?ref=app
https://www.sololearn.com/discuss/384110/?ref=app
https://www.sololearn.com/discuss/987379/?ref=app
https://www.sololearn.com/discuss/193311/?ref=app
https://www.sololearn.com/discuss/1264812/?ref=app
https://www.sololearn.com/discuss/166557/?ref=app
+ 3
1. Turn the number into a string
2. Reverse the string
3. Compare the original string against the reversed string
+ 3
Using the operation:-
(Number)%10
And
(Number)/10
You can get the last digit of the number. And reduce the number to one tenth of its value. Just do this again and again and you will be able to seperate the number into an array(just like Rik Wittkopp said)
Then all you have to do is to check weather that array is palindrome or not(just like you do for strings)