STRING PALINDROME IN C
Palindrome strings are those string values which produce same meaning after reverse.
for example "radar" is palindrome string value because it produce same meaning even after reverse this string value.
C PROGRAM FOR STRING PALINDROME
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
clrscr();
char a[60], b[60];
int c;
puts("Enter any string value: ");
gets(a);
// Copy string variable A value in string variable B
strcpy(b, a);
// Reverse the value of string variable B
strrev(b);
// Comparing variable A and variable B
c=strcmp(a, b);
// Finding string palindrome or not
if(c == 0)
{
printf("String is palindrome");
}
else
printf("String is not palindrome");
getch();
}
----------------------------
OUTPUT - I
----------------------------
Enter any string value:
Computer
String is not palindrome
----------------------------
OUTPUT - II
----------------------------
Enter any string value:
radar
String is palindrome
0 Comments