Showing posts with label Program to check for palindrome. Show all posts
Showing posts with label Program to check for palindrome. Show all posts

Thursday, July 21, 2011

Program to check for palindrome

/*Serial No.101     [swami77.cpp]*/

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,len,flag;
char str[10],rev[10];
clrscr();
printf("Enter the string==>");
scanf("%s",str);
len=strlen(str);
printf("\nLength of %s is ==>%d\n",str,len);
for(i=0;str[i]!='\0';i++)
    {
    if(str[i]!=str[len-1-i])
      {
      flag=3;
      break;
      }
    }
if(flag==3)
    printf("\nString is not polyndrom");
     else
    printf("\nString is polyndrom");
getch();
}