Tags
/*Programm to check weather the entered string is palindrome or not
without using library function*/
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20];
char revStr[20];
int i=0,j=0,strLen=0,c=0;
printf("\nEnter the string to be Checked for palindrome:");
scanf("%s",&str);
for(i=0;str[i]!='';i++)
{
strLen=strLen+1;
}
i=0;
for(j=strLen-1;j>=0;j--)
{
revStr[i]= str[j];
i++;
}
revStr[i]='';
printf("\nreversed str=%s",revStr);
while(str[c] == revStr[c])
{
if(str[c] == '' || revStr[c]=='')
break;
c++;
}
if(str[c] == '' || revStr[c]=='')
printf("\nString is Palindrome\n");
else
printf("\nString is not Palindrome");
printf("\nEnd Of Programm");
getch();
}