Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int check_palindrome(char* str)
- {
- int len = strlen(str), i, j;
- for(i=0, j=len-1; i<j; i++, j--)
- {
- if(str[i] != str[j])
- return 0; //not palindrome
- }
- return 1; //palindrome
- }
- int main()
- {
- char inputString[100];
- printf("Enter String : ");
- scanf("%s", inputString);
- if(check_palindrome(inputString))
- printf("Palindrome");
- else
- printf("Not Palindrome");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement