Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- char s[10],rev[10];
- int len=0,i,j=0,f=0;
- printf("Enter string: ");
- scanf("%s", s);
- for(i=0; s[i]!='\0'; i++) {
- len=len+1;
- }
- for(i=len-1; i>=0; i--) {
- rev[j++]=s[i];
- }
- rev[j++]='\0';
- for(i=0; i<=len; i++) {
- if(s[i]!=rev[i]) {
- f=1;
- break;
- }
- }
- if(f==0)
- printf("\n%s is a Palindrome.",s);
- else
- printf("\n%s is not a Palindrome.",s);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement