bool isPalindrome(int arr[], int n) { for (int i = 0; i < n / 2; i++) { if (arr[i] != arr[n - i - 1]) { return false; } } return true; }
int main() { int n; cout << "Enter the size of the array: "; cin >> n;
int arr[n]; cout << "Enter the elements of the array: "; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (isPalindrome(arr, n)) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0;
using namespace std;
bool isPalindrome(int arr[], int n) {
for (int i = 0; i < n / 2; i++) {
if (arr[i] != arr[n - i - 1]) {
return false;
}
}
return true;
}
int main() {
int arr[n];int n;
cout << "Enter the size of the array: ";
cin >> n;
cout << "Enter the elements of the array: ";
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (isPalindrome(arr, n)) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}