4 like 0 dislike
268 views

將英文字母(不超過5個字母)的位置依照下述方法排列

若有奇數個字母,中間保持不動,兩旁的字母各自反轉

若有偶數個字母,左右方成兩邊各自反轉

input hswo
output show
input ehlol
output hello
input on
output on

 

[Normal] Coding (C) - asked in 程式設計(一)
ID: 40615 - Available when: Unlimited - Due to: Unlimited

retagged by | 268 views
0 0
excellent

2 Answers

0 like 0 dislike
Hidden content!
** * *** ** *
** * *** ** *** ** *
int main()
{
* ** * **** char arr[10];
**** * * * * * * * ** * * *** *****
***** * ** **** {
*** ** * * *** * *** * int i,j;
* ** * **** * * * * * ****** char temp;
** * ** *** * *** **
** * * *** *** **** if(i==5)
**** * * **** *** * {
** ** * *** *** ** ** * * * **
*** * * * * ** * *** * * ** ** * ******
* * * *** ** ** * * * ** * * *
**           *** *
*****           * *
**** *       ***   * * * * * *
*** *** ** * * * *   * ** ** * ** ****** * * ** **
* *** * **** *** ** * ** }
*** * * * * * *** else if(i==4)
* * ** * * ***** * {
** *** * * * * * ** ** *** * *
* * ** *** * * * * *** * * * *** ** *** *
**** * * *** * ** * ** ** * ** * * ** *
** *** * * * ** ** **** *** ** ** * * **
**** * * * * ** * *** ** * * ** * ****
**** ***** * * * ** * * *** ** * *
** ** * * * *** ***** * ***** * * ** * ** ** *
* * **** * * ** * }
** *** * * *** else
* ** * *** * * * * * {
* *** * ***** ** *** ** * ** * **** *** * * ** * *
* * * ***   * ** }
* * * * }
* * * return 0;
}
answered by (100 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
    int n,i;
    char arr[5]={0};
* * * * ***** * *** **** * * ** ******
* * * *** * * *** *** **** ** ** * **
    {}
** * * * ****** * ** ** ** * *** **
*** * * **** **** *** * ** ** *
** * * * * *** **** **** ** * * ** * **
****** * * * ** ** ** * *
*** ** * ** * *** * * **** *** ** ** * *
** ** ** ** ** ** ** *** *
*** * ****** * * ******** ** ** * * * * * ** * **
**** * * * **** ** **** **
*** ***** * * ** * ** **** * * ** ** * * ** *** * * *
*** *** *** *** *** **** * *
** * ** * * * * **** * * * * * *** * * * *** * ** * *** * ** * ** *
** *** *** ** *** * * **** ***** **
}
answered by (192 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.7
©2016-2024

Related questions

4 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2018 in 程式設計(一)
ID: 40624 - Available when: Unlimited - Due to: Unlimited
| 650 views
4 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2018 in 程式設計(一) by semicolon (5.2k points)
ID: 40621 - Available when: Unlimited - Due to: Unlimited
| 355 views
2 like 0 dislike
0 answers
[Normal] Fill in the blank - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
ID: 21888 - Available when: Unlimited - Due to: Unlimited
| 116 views
12,783 questions
183,443 answers
172,219 comments
4,824 users