Toggle navigation
Courses
Questions
Tags
Users
AC 20170105 期末 第三題
0
like
0
dislike
2k
views
請設計一個程式,使用者會輸入一個字串,請判斷該字串是否為回文(palindrome)。
輸入範例1:
12321
輸出範例1:
12321 is a palindrome
輸入範例2:
apple
輸出範例2:
apple is not a palindrome
[Exercise]
Coding (C)
-
asked
Jan 5, 2017
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 20980 -
Available when:
Unlimited
-
Due to:
Unlimited
reshown
Jan 5, 2017
by
Shun-Po
|
2k
views
comment
Please
log in
or
register
to add a comment.
43
Answers
0
like
0
dislike
Hidden content! ** * * *** * * * * *
* * * ** *** * * *
int is_palindrome(char *s)
{
* ** * * **** a, k;
k = strlen(s);
* ** * * = 0;a <(k /2);a++)
*** * * ***
* * ** ** * ** * * ** * ** * ** ** * (s[a] != s[k-a-1])
** * ** * * * * * * * * **** * * * * * ** * * * 0;