Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main () {
- int tam;
- std::cin >> tam;
- int arr [tam];
- for (int i = 0; i < tam ; ++i){
- std::cin >> arr [i];
- }
- int act = 0, cont = 0;
- while (act < tam / 2){
- if (arr[act] == arr[(tam - 1) - act]){
- ++cont;
- } else {
- break;
- }
- ++act;
- }
- std::cout << (cont == tam / 2 ? "Palindromo" : "No es palindromo\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement