write a c program to determine whether a string is palindrome,palindrome program in c,string palindrome program in c using strrev
Write a c program to determine whether a string is palindrome
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[30],r[30];
clrscr();
printf("Enter the string: ");
gets(s);
strcpy(r,s);
strrev(r);
if(strcmpi(s,r)==0)
printf("It is a palindrome");
else
printf("It is not a palindrome");
getch();
}
Output:
run 1:
Enter the string: madam
It is a palindrome
run 2:
Enter the string: english
No comments: