Is there any way to simplify Palindrome Numbers coding?
this is my code for Palindrome Numbers and I'm wondering if there's anyway to improve or simplify #include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function //define variables int arrsize=1; int j=x; int l=x; int m; int o; //feaguring arrsize while(j/10>=1){ j /= 10; arrsize++; } //put single integer into array int arr[arrsize]; for(int k=0;k<arrsize;k++){ m = l%10; arr[k]=m; l/=10; } //check if it's palindrome for(int n=0;arrsize>n;n++){ if(arr[n]==arr[arrsize-1-n]){ } else return false; } return true; } //remain as the question int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; }