Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char pal[150];
- char temp[150];
- printf("\nEnter a string to check if palindrome or not\n");
- gets(pal); //takes input from user
- strcpy(temp,pal); //copies the input to another temporary array
- if(strcmp(strrev(pal),temp)==0) //compares to see if it returns a non zero value or not
- {
- printf("%s is a palindrome",temp);
- }
- else
- {
- printf("%s is not a palindrome",temp);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement