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..

15th Feb 2020, 10:41 AM
UbuUunTu✔️
UbuUunTu✔️ - avatar
3 odpowiedzi
+ 3
1. Turn the number into a string 2. Reverse the string 3. Compare the original string against the reversed string
15th Feb 2020, 10:44 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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)
15th Feb 2020, 11:12 AM
Arsenic
Arsenic - avatar