Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void main()
- {
- char string[25];
- char string2[25]={'\0'}; //strings initialised
- int a=0;
- int b=0;
- int c=0;
- printf("Enter a word to check if it is a pallendrome. \n");
- gets_s(string);
- for(a=0;string[a]!='\0'; a++)
- {
- }
- c=a-1;
- for(b=0;b<a;b++)
- {
- string2[b]=string[c];
- c--;
- }
- if(strcmp(string,string2)==0)
- printf("%s is a pallendrome.\n", string);
- else
- printf("%s is not a pallendrome.\n", string);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement