Palindrome numbers project answer?😢 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

Palindrome numbers project answer?😢

Please

28th Nov 2021, 5:13 PM
مصطفى المهدي
مصطفى المهدي - avatar
7 Answers
+ 4
Hello مصطفى المهدي Please show us your attempt.
28th Nov 2021, 5:30 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Please mention language as well as attach your code....
28th Nov 2021, 5:18 PM
Pihu ( Not Active )
+ 3
Is it the code project from the sololearn course? What is "example"? It is never declared??? Don't hard code the number – it is input and may vary. One way to approach it, is to make the number as string and construct another a string that is the reversion of the number string. Than you can compare the 2 strings – if they are equal, return true, else false
28th Nov 2021, 6:39 PM
Lisa
Lisa - avatar
+ 2
/***Try this***/ bool isPalindrome(int x) { int y=x; int z=0; while(x){ z=z*10+x%10; x=x/10; } return y==z; }
29th Nov 2021, 5:12 PM
Abdelkader Chhaibi
Abdelkader Chhaibi - avatar
0
C++please help
28th Nov 2021, 5:19 PM
مصطفى المهدي
مصطفى المهدي - avatar
0
#include <iostream> using namespace std; bool isPalindrome(int x) { x=example; example=8888; } int main() { int n; cin >>n; if(!isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0;
28th Nov 2021, 5:33 PM
مصطفى المهدي
مصطفى المهدي - avatar
0
Thanks Lisa 😁😁
28th Nov 2021, 6:40 PM
مصطفى المهدي
مصطفى المهدي - avatar