Ads 468x60px

Labels

Jun 7, 2012

#8 - Palindrome (Compare Two Strings) - [C]

#include"stdio.h"
#include"string.h"
void main()
{
char s1[20], s2[20];
clrscr();
printf("\n Enter the string \n");
scanf("%s",&s1);
strcpy(s2,s1);
strrev(s1);
if(strcmp(s2,s1))
printf("\n The string %s is not palindrome",s2);
else
printf("\n The string %s is palindrome",s2);
getch();
}

No comments:

Post a Comment