ivana_andreevska

Untitled

May 19th, 2021
175
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 <ctype.h>
  5. #define MAX 101
  6.  
  7.  
  8.  
  9. int ispalrec(char *s,int start,int end)
  10. {
  11.     start=0;
  12.     end=strlen(s)-1;
  13.  
  14.     if(start>=end)
  15.         return 1;
  16.     else{
  17.         if(s[start]!=s[end]){
  18.             return 0;
  19.         }else{
  20.         return ispalrec(s,start+1,end-1);
  21.         }
  22.     }
  23. }
  24.  
  25. int main()
  26. {
  27.     char string[MAX];
  28.     gets(string);
  29.  
  30.     printf("%d",ispalrec(string,0,strlen(string)-1));
  31.  
  32.     return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment