#include
void main()
{
int first,last,flag=1;
char str[100];
clrscr();
printf("enter number to get to check wheather palindrome or not");
gets(str);
first=0;
last=strlen(str)-1;
printf("%d",first);
printf("%d",last);
while(first<=last)
{
if(str[first]!=str[last])
flag=0;
first++;
last--;
}
if(flag==1)
{
clrscr();
printf("this is palindrome");
getch();
}
else
{
clrscr();
printf("sorry this is not a palindrome");
getch();
}
}
No comments:
Post a Comment