Monday 9 September 2013

c program to check whether given string is palindrome or not

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[20],rev[20];
clrscr();
printf("enter a string..");
gets(str);
strcpy(rev,strrev(str));
if(strcmp(strrev(rev),str)==0)
{
printf("your string is a palindrome");
}
else
printf("not a palindrome..");
getch();
}

No comments:

Post a Comment