E.g. NITIN, LIRIL, MALAYALAM.
#include<stdio.h>
#include<conio.h>
#include<process.h>
main()
{
int i,j,len=0;
char *s1,*s2;
clrscr();
printf("Enter the string ....");
scanf("%s",s1);
for(i=0;s1[i]!='\0';i++)
len++;
j=0;
for(i=len-1;i>=0;i--)
{
s2[j]=s1[i];
j++;
}
s2[j]='\0';
for(i=0;s1[i]!='\0';i++)
if(s1[i]!=s2[i])
{
printf("\nNot a palindrome");
getch();
exit(0);
}
printf("Palindrome");
getch();
}
please explain this logic
Hi Shivam, please try executing this in Turbo C compiler, this just checks whether string is palindrome or not, that’s it.