Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int i=0,czy=1,dlugosc;char tab[100]={'\0'};
- do
- {
- czy=1;
- fflush(stdin);
- fgets(tab,100,stdin);
- for(i=0;tab[i]!='\0';i++);
- dlugosc=i-1;
- //printf("dlugosc=%d\n",dlugosc);
- for(i=0;i<(dlugosc/2);i++)
- {
- if(tab[i]!=tab[dlugosc-i-1])
- czy=0;
- }
- if(czy&&dlugosc>0) printf("palindrom\n"); else printf("nie palindrom\n");
- }while (tab[0]!='\n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement