+ 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; }
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
+ 4
Thank you so much Sir Simba, it works😊
+ 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";
+ 1
I am going to write a post saying 'you're Welcome, jonalyn' in Q&A discussion 😊