Program to check a string for palindrome without using library functions.
*/
#include<conio.h>
#include<stdio.h>
int IsPalindrome(char []);
int main()
{
char string[100];
clrscr();
printf("Enter A String.");
scanf("%s",string);
if(IsPalindrome(string))
{
printf("%s is palindorme.",string);
}
else
{
printf("%s is not palindorme.",string);
}
return 0;
}
int IsPalindrome(char *a)
{
char *start,*end;
start=end=a;
while(*end != '\0')
{
end++;
}
end--;
while(start
if(*start != *end)
{
return 0;
}
start++;
end--;
}
return 1;
}
No comments:
Post a Comment