| Home > Source Code > C program to check whether a String is Palindrome or not? |
|
| C program to check whether a String is Palindrome or not? |
| |
C program to check whether a String is Palindrome or not?
Contributed by : Kaustubh Bagal |
| |
#include<stdio.h>
#include<string.h>
#define size 26
void main()
{
char strsrc[size];
char strtmp[size];
clrscr();
printf("\n Enter String:=
"); gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n Entered string
\"%s\" ispalindrome",strsrc);
else
printf("\n Entered string
\"%s\" is not
palindrome",strsrc);
getch();
} |
| |
|