Palindrome numbers
I'm making a code that checks whether the number is a palindrome or not. Here is my code: #include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function int n; int num; int digit; int rev; n = num; do { digit = num % 10; rev = (rev * 10) + digit; num = num / 10; } while (num != 0 ); return 0; } int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; } I'm so close. The only issue is that it only corrects the numbers that are not palindrome, and not the ones that are palindromes. Can someone explain to me why this is happening? Thank you!