It’s the Palindrome string C program that inputs string from the user, then check string is palindrome or not i.e sting same as to reverse of the string, and print result on the screen.
To understand this program, it’s better you should know the following topics:
Program (1): to check given string palindrome or not.
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char s1[20],s2[20]; printf("enter a string: "); scanf("%s",s1); strcpy(s2,s1); strrev(s2); if(strcmp(s1,s2)==0) printf("String is a palindrome"); else printf("Not a palindrome string"); getch(); }
Output (1)
enter a string: mam String is a palindrome