Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- bool palindromo (int *ini, int *fin){
- if (fin - ini <= 1) {
- return true;
- } else {
- if (*ini == *(fin - 1)){
- return palindromo(ini + 1, fin - 1);
- } else {
- return false;
- }
- }
- }
- int main () {
- int tam;
- std::cin >> tam;
- int arr [tam];
- for (int i = 0; i < tam ; ++i){
- std::cin >> arr [i];
- }
- std::cout << (palindromo(arr, arr + tam) == 1 ? "Es palindromo\n" : "No es palindromo\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement