/*write a c program to check whether the string is
palindrome or not */
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[30],str2[30],p;
clrscr();
printf("enter the string:\n");
gets(str1);
strcpy(str2,str1);
strrev(str1);
printf("\nthe reverse string is :%s",str1);
p=strcmp(str1,str2);
if(p==0)
printf("\nthe string is palindrome");
else
printf("\nthe string is not palindrome");
getch();
}
/*
enter the string:
peersaab
the reverse string is :baasreep
the string is not palindrome
enter the string:
mam
the reverse string is :mam
the string is palindrome
*/
No comments:
Post a Comment