Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define TRUE 1
- #define FALSE 0
- int palindrom(char *a, int count)
- {
- int i = 0;
- while(i<=count)
- {
- if (a[i]!=a[count-1])
- return FALSE;
- i++;
- count--;
- }
- return TRUE;
- }
- int main()
- {
- char s[256];
- FILE *f1=fopen("karin.txt","r");
- FILE *f2=fopen("karout.txt","w");
- while(fscanf(f1,"%s",s))
- {
- if (palindrom(s, strlen(s)))
- fprintf(f2,"yes ");
- else
- fprintf(f2,"no ");
- if (feof(f1))
- break;
- }
- fclose(f1);
- fclose(f2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement