Home > Back-end >  Write a function to judge whether palindrome string
Write a function to judge whether palindrome string

Time:11-07

# include "stdio.h"
# include "string. H"
# define n 100
Int check (char [] s)
{
Int I, j, flag;
Flag=1;
I=0;
j=0;
For (; i<=j;)
{
i++;
J -;
If (s [I]!=s [j])
{
flag=0;
break;
}

}
Return flag;
}
Void main ()
{
Char s [n].
Printf (" please input a string: ");
Gets (s);
If (check (s)==0)
Printf (" the string is not a palindrome, ");
The else
Printf (" the string is a palindrome, ");
}
Where is the great god help me to look at the wrong
I have a mistake, the output of the display is not a palindrome, whatever input
  • Related