Israel_Torres

source3

Jan 19th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "headers3.h"
  5.  
  6. void palindromo()
  7. {
  8.  
  9.     int letras = 0;
  10.     int i = 0;
  11.     char str[99];
  12.     printf("Ingresa una palabra: ");
  13.     scanf("%s", str);
  14.  
  15.     letras = strlen(str);
  16.     for(i = 0; i < letras; i++ )
  17.     {
  18.         if(str[i] != str[letras-1])
  19.         {
  20.             printf("No es un palindromo ");
  21.                 return 0;
  22.         }
  23.         letras--;
  24.     }
  25.    printf("Si es un palindromo ");
  26.    return 0;
  27.  
  28. }
Add Comment
Please, Sign In to add comment