Wednesday, July 20, 2011

Program to check whether the string is palindrome or not {using library functions}

/*Serial No.49     [swami21.cpp]*/

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define size 26
void main()
{
char strsrc[size];
char strtmp[size];
clrscr();
printf("\n Enter String:= "); gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string \"%s\" is palindrome",strsrc);
else
printf("\n Entered string \"%s\" is not palindrome",strsrc);
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...