Google Search

Saturday, October 24, 2015

String Palindrome Checking using C Programming

‪#‎include‬<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char st[20];
int flag=0,i,l;
clrscr();
printf("enter any string\n");
gets(st);
l=strlen(st);
for(i=0;i<l/2;i++)
if(st[i]!=st[l-1-i])
{
flag=1;
break;
}
if(flag==0)
printf("String is Palindrom");
else
printf("String is not palindrom\n");
getch();
}

No comments:

Post a Comment