Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define M 100
- /*8.Implementar una función recursiva en C que permita determinar si un arreglo de números enteros es
- palíndromo o no. No podrá usar arreglos adicionales y la función solo podrá recibir dos parámetros:
- el arreglo y su longitud
- *
- */
- int EsPalindromo(char V[],int fin){
- int i=0;
- if(i>=fin)
- return 1;
- if (V[strlen(V)-fin-1]==V[fin]){
- return EsPalindromo(V, fin-1);
- }
- else
- return 0;
- }
- int main(int argc, char** argv) {
- int EP;
- char V[]="ANITALAVALATINAL";
- int n = strlen(V);
- EP=EsPalindromo(V,n-1);
- if (EP==1)
- printf("La palabra es palindromo");
- else
- printf("La palabra no es palindromo");
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement