int palindrome( char* string )
{
int i = 0, j = strlen( string ) - 1;
while( i < j / 2 )
{
if( string[ i++ ] == string[ j-- ] )
;
else
{
printf( "The String is not Palindrome" );
return -1;
}
}
printf( "The string is Palindrome" );
return 0;
}
int main( )
{
palindrome( "Info " );
palindrome( "Computers" );
return 0;
}
No comments:
Post a Comment