3 like 0 dislike
6.7k views
迴文判斷

迴文是指一個字串從前面讀過去跟從後面讀過去是一樣的

所以 abcdcba 是一個迴文

請寫一個程式判斷書入的字串是不是迴文

輸入說明:

會輸入一個字串,字串中間不會包含空白字元

輸出說明:

如果輸入的字串是迴文,請輸出YES,反之則輸出NO

輸入範例:

abcdcba

輸出範例:

YES
[Exercise] Coding (C) - asked in 2017-1 程式設計(一)AD by (18k points)
ID: 33757 - Available when: Unlimited - Due to: Unlimited
| 6.7k views

22 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
** * * *** ** n,i,same=0;
* * * ** * * ** * **** * ** a[999];
** * *** ** ******* * *** ** *** * *** * *
****** * ** * *** ** * *
    
* * * **** * * * * ** ** ***
    
** * * * ** * * * *** *** *
*** *** * *** ** ** **
*** **** * * ** *** **** ** * * * * ** * **
* **** ** * * *** * * ** * * ******* * *
*** *** * ** ** * * * * * * * ** * * **
* * * ** ** ***** **** *** *
** ** * ** ***** * *** * ** * *** * * ** ** * * *
* * * ***** * * * * * * * ** *** ** ** * * ***
* * ** * ** *
* * ** * ** ** ****
** ** * ** ** * *** ** * ** *** *** * **
* * ** **** ** * * *
* ** * ***** * ****** * **
    
    
}
answered by (192 points)
0 0
prog.c: In function 'main':
prog.c:7:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[999]' [-Wformat=]
     scanf("%s",&a);
             ^
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* ** * * * * * * * *** i,n=0,k=0;
**** **** * *** **** * * ** a[1000];
** * ** * ***** ***** * *** ** ** *** ** *
***** ****** ** * **** * ** ** * * **
    {
*** * * *** ** ** **** ** *** ******* ***
    }
*** *** ** * * * ***** **** * * *
    {
** ** * *** * * ** ***** * * * *** * ** ** *
***** * * ** * * ***** ** ** * * **
***** * **** * *** * ** * *** ** *** * ** ** * ***
*** ***** ** *** * * * * ** *** ** *   
* * ** *** ******
* * * ** ** * *******
** * *** * ** *** * ****** * * *** * ** * ***
** *** *** ** ** ** ****
**** ***** ** * ** * * *** * *
}
answered by (30k points)
0 0
Case 0: Correct output
Case 1: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.114
©2016-2025

Related questions

2 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 33762 - Available when: Unlimited - Due to: Unlimited
| 5.7k views
3 like 0 dislike
20 answers
[Exercise] Coding (C) - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 33758 - Available when: Unlimited - Due to: Unlimited
| 5.3k views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33763 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 1.2k views
3 like 0 dislike
5 answers
[Exercise] Coding (C) - asked Nov 30, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 34978 - Available when: Unlimited - Due to: Unlimited
| 2.1k views
3 like 0 dislike
6 answers
[Exercise] Coding (C) - asked Nov 30, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 34979 - Available when: Unlimited - Due to: Unlimited
| 2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users