How to get a palindrome number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get a palindrome number?

Two 3 digit numbers are multiplied together..if the product's first number==to its last number,its a palindrome,how can i do it?

7th Oct 2018, 9:23 AM
Mensch
Mensch - avatar
2 Answers
+ 1
couldn't be simpler. hundreds of code samples for palindromic numbers are available on the Internet Still: what is your problem: 1. algorithm 2. code in c++ be VERY precise in defining what you really need. your definition of the palindromic number is wrong. there's a difference between a number and a digit
7th Oct 2018, 10:57 AM
Skipper
Skipper - avatar
+ 2
It is more than first/last number. It is the first half of the number is equal to the reverse of the second half so convert to digits or string and reverse it back into a number. If the result is your original number, it is a palindrome.
7th Oct 2018, 2:47 PM
John Wells
John Wells - avatar