Wednesday, 11 February 2015

Palindrome In c using strcpy

#include
#include

void main()
{
char a[100], b[100];
d:
printf("Enter the string to check if it is a palindrome\n");
gets(a);

strcpy(b,a);
strrev(b);

if( strcmp(a,b) == 0 )
{
printf("Entered string is a palindrome.\n");
}
else
{
printf("Entered string is not a palindrome.\n");
}

}

No comments:

Post a Comment