C program to input any string and determine whether it is palindrome or not.

C program to input any string and determine wheter it is palindrome or not.

#include<stdio.h>
#include<conio.h>
void main( )
{
char str[20]; int i;
clrscr( );
printf("enter any string ");
scanf("%s",str);
i=0;
while(str[i]!='\0')
{
if(str[i]==str[i+2])
{
printf("string is palindrome ");
break;
}
else
{
printf("string is not palindrome ");
break;
}
getch( );
}

Post a Comment

0 Comments