+ 2

Now code works!!! Thank you all...

#include<iostream> using namespace std; bool isPalindrome (int x){ int num, rem, rev = 0; num = x; while (x != 0) { rem = x % 10; rev = rev * 10 + rem; x /= 10; } return (rev == num); } int main() { int n = 0; cin >> n; if(isPalindrome (n)) { cout << n << " is a palindrome"; } else { cout << n << " is NOT a palindrome"; } return 0; }

12th Sep 2021, 5:06 AM
Jonalyn E. Lawis
Jonalyn E. Lawis - avatar
4 Réponses
+ 5
You can ask this in your previous post, no need to post here again... https://www.sololearn.com/Discuss/2879994/?ref=app
12th Sep 2021, 5:11 AM
Rupali Haldiya
Rupali Haldiya - avatar
+ 4
Thank you so much Sir Simba, it works😊
12th Sep 2021, 5:38 AM
Jonalyn E. Lawis
Jonalyn E. Lawis - avatar
+ 2
If you're trying to complete Sololearn palindrome project, p should be lowercase in palindrome cout << n << " is a palindrome"; cout << n << " is NOT a palindrome";
12th Sep 2021, 5:14 AM
Simba
Simba - avatar
+ 1
I am going to write a post saying 'you're Welcome, jonalyn' in Q&A discussion 😊
12th Sep 2021, 6:14 AM
Sacar
Sacar - avatar