The BOTTOM LINE Quote Of The Day

The BOTTOM LINE Quote Of The Day

Don't Ever Tell GOD How BIG Your Problems are.
Just Tell Your Problems How BIG your GOD is ;)

Sunday, March 18, 2012

Find Palindrome of String


#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