#include<stdio.h>
#include<conio.h>
#include<string.h>
char a[20];
int l;
int palin(int num)
{
if(num>l/2)
return 1;
if(a[num] == a[l-num-1])
return palin(num+1);
else
return 0;
}
void main()
{
clrscr();
printf("Enter a String : ");
gets(a);
l = strlen(a);
int ret = palin(0);
if(ret == 1)
printf("\n Palindrome");
else
printf("\n Not Palindrome");
getch();
}
No comments:
Post a Comment