Toggle navigation
Courses
Questions
Tags
Users
AC 20170105 期末 第三題
0
like
0
dislike
1.9k
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
|
1.9k
views
comment
Please
log in
or
register
to add a comment.
43
Answers
0
like
0
dislike
Hidden content!#include * * * ***** **
#include * ** * * **** **
* ** * * ** ** * *** * * *s)
{
* * * * *** * *** * * ** * i, len;
* * * * ** * **** * * = strlen(s);
*** * ** **** ***** * * = 0; i < (len /2); i++) {
* * * * ** *** * * * ** * * * ** * (s[i] != s[len-i-1])
* * ** * * * * * * * *** ** * * * * ** * * 0;
* ***** * *****
* ** * * ** * * * * * (i >= len/2)