programming-examples/c/_Basic/Write a c program to check given string is palindrome number or not.c

18 lines
444 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
#include <stdio.h>
#include <conio.h>
void main() {
char *a;
int i,len,flag=0;
clrscr();
printf("\nENTER A STRING: ");
gets(a);
len=strlen(a);
for (i=0;i<len;i++) {
if(a[i]==a[len-i-1])
flag=flag+1;
}
if(flag==len)
printf("\nTHE STRING IS PALINDROM"); else
printf("\nTHE STRING IS NOT PALINDROM");
getch();
}