0 喜歡 0 不喜歡
6k 瀏覽

Please write a program using an array to receive 5 numbers, then output those inputs in reverse order as examples shown.

Input (i)

1 2 3 4 5

Input (ii)

1
2
3
4
5

 

Output (i) acceptable

54321

Output (ii) acceptable

5 4 3 2 1 

 

More information

https://www.tutorialspoint.com/cprogramming/c_arrays.htm

 

[練習] Coding (C) - 最新提問 分類:Chapter 4: Arrays | 用戶: (5.9k 分)
ID: 35804 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 6k 瀏覽

17 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * * **** * ** * * *
** * ***
int main()
{
**** ** ** ** * ** * n = 4, c, d, a[100], b[100];
* * ***
** ** * ** *
* ** ** * * ** * * * * (c = 0; c * * * n ; c++)
* * * **** **** * *** ** ** ** ** **** ** ** * * * * *
***
* *** ***** ** * **** *
* * *
** * *** **** (c = n , d = 0; c **** 0; c--, d++)
** ** *** ** ** ** * **** *** * ****** *** = a[c];
**** *
* ***** * * **
** *
*** * * * * ***** (c = 0; c ******** n; c++)
* ** * ** ** * ** ** ******* * * * = b[c];
***
** ***
* * * ** ** * *** * (c = 0; c * ** * n; c++)
* * ** ** **** **** *** ** ** *** ********** **** a[c]);
**
** * * *** ** *** * *
* ****** * ** 0;
}
100/100 最新回答 用戶: (192 分)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include **** * **** * * **
* **
int main()
{
* *** * * *** * n = 4, c, d, a[100], b[100];
** *
* * * * *** **
* * * * * ** (c = 0; c * ** n ; c++)
** ** *** * **** * * * * * * * *** * **** ** *****
* *
* * **********
****
*** * ** *** * * (c = n , d = 0; c ** *** 0; c--, d++)
* ***** ** ** *** * * * *** ** = a[c];
* *
* **** ** *** **
* *
* * * * ** (c = 0; c * * * n; c++)
* ** ** ****** *** * * * * * * * * ** = b[c];
***
* *
** * ** * * * (c = 0; c * n; c++)
* * * * **** * * ***** * * ** * **** *** a[c]);
* **
* *** ***** * * *** *
* * * ** 0;
}
100/100 最新回答 用戶: (183 分)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main(void)
{
**** * * *** * ** ** * tab[5],i;
* * *** **** ** * * *** * * * *
* * * ** * *** ***
* ** * * * **** *** * * ***** * * * * ** ** **** ***** ** * **** *
* ** * ** * ** ** * * *
* *** * ***** * * * * ** (i=4;i>=0;i--)
* * ** * ** *** ** * ***
* * * **** ** * * *** ****** * * * *** ****** ** * * ",tab[i]);
****** * ** ****
** * * * ** ** **** * ** 0;
}
100/100 最新回答
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
*** ** * * * * *
* ** ** ** ***

int main(){
*   int * ****
***** * ** * **
** ** * * * for(int * ******* ** **
***** ****** * ** * * *** * * **** **** ****
** ** * }
}
100/100 最新回答 用戶: (244 分)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * * *
**** * ** ** **

int main () {

* * ** * *** * * n[5];
* ** *** * ***** ** i,j;
*** * ** * * ** size=5;
* * *
** *** *** * ** * * * ***** elements of array n to 0 */ * **** ** ** *** ** ** ** * ** ** **** * ***
** * *** ***** * * ( i = 0; i < size; i++ ){
* * **** * **** * * ** *** * * **** * * ** * **
** * ** * * ** ** *
* ** ** *** * *
* ** ** ** ** * ** output each array * ** value */

for(j = 4; * j--){
* ** ** **** * * * ** * * * ** * * *** ** * *
** ** ************ **

* * ** *
** * ** *** ****** * * * ** * ** ***** * * *** * * *
*** *** *** return 0;
}

*** ** * *
100/100 最新回答 用戶: (221 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:16:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("%d", j, x[j]);
             ^~~~
0 0
ERROR:         printf("%d", j, x[j]);
0 0
prog.c:29:2: error: expected identifier or '(' before 'return'
  return 0;
  ^~~~~~
prog.c:30:1: error: expected identifier or '(' before '}' token
 }
 ^
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * *

int main(int argc, char *argv[]) {
* * ** **** * * * a[5],i;
** *** * * ***** *** * * {
* *** * *** * * * * *** ** * * ** * ***** ** * ** * ** &a[i]);
* ** * * *** * *
* **** * **** *** * ** ** *** {
***** * ** * * * **** * * * ************ * * *** * * ", a[i]);
**** ** ** * * ** ** *
}
100/100 最新回答 用戶: (273 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * *** *** *
int main(){
** * *** * * * x[5], i;
* ** *** * *
* * * ***** * ** ** *
* * ** *** ** * * ** **** * * &x[i]);
*** ** * * **
* **** ***** * * * i--){
* * * ** ** * * * * * ** ** * * * x[i]);
** ** **
**** ***
** *** * 0;
*** ** * *
}  
100/100 最新回答 用戶: (254 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
Case 5: Wrong output
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main(void)
{
* *** ** ** ***** * ** * ** tab[5],i;
** **** * * * * * ** *****
* *** ****** * ** *
*** *** *** ***** * * ****** * * * ** *** * * * ** * ***
** * ** ** * *** ***
* * *** * * ***** * * ** (i=4;i>=0;i--)
***** *** ** * ** * ** *
* * * * ******** * * * ** ** ** ** *** * ** * * * ",tab[i]);
* * * * ** *** * * * ****
* **** *** * *** * ** ** 0;
}
100/100 最新回答 用戶: (283 分)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * * *****
**
int main()
{
* **** ***** n = 4, c, d, a[100], b[100];
** **
** * ** ** **
** ** *** ** *** (c = 0; c * * n ; c++)
* ** *** ** * * *** ** * * * **** **** * * * *** **
******
* ** * ** * * ****
* * *
*** **** **** * ** (c = n , d = 0; c **** * 0; c--, d++)
**** * *** ** *** ** ***** ** *** * **** * = a[c];
* ** *
** * ****** ****** * *
* ** **
*** ** * * * * (c = 0; c * * n; c++)
* ** * * * *** *** * * *** ** ** *** *** = b[c];
** *
***** * *
* *** ** *** ** ** * (c = 0; c * ** n; c++)
* * ***** * ** * * *** ** ** *** ** *** * * a[c]);
*****
** * **** * *** *
* ** * * * 0;
}
100/100 最新回答 用戶: (153 分)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include ** * * * ** **
***** *
int main()
{
* **** * *** *** n = 4, c, d, a[100], b[100];
* *
* * ** ** * **** ****
*** ** ** ** (c = 0; c * * n ; c++)
** **** * ** * ** ******* * * * ** ** * * * ** **
** * *
*** ** *** * **** *
* * ****
** ** * * ** ** (c = n , d = 0; c *** 0; c--, d++)
** ** ** * ** * * ** ***** * **** = a[c];
* **
***** **** * * * **

* ****** ** * ** * (c = 0; c * * n; c++)
* * * ** **** ** **** *** = b[c];
** *
* *
****** * * * *** ** (c = 0; c ** n; c++)
* ** * * **** * * **** ** * ** ** *** ** * * * a[c]);
* *** *
* * * **
* ** * ** * 0;
}
100/100 最新回答 用戶: (268 分)
0 0
prog.c: In function 'main':
prog.c:26:3: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
   system("PAUSE");
   ^~~~~~
0 0
prog.c: In function 'main':
prog.c:25:3: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
   system("PAUSE");
   ^~~~~~
0 0
prog.c: In function 'main':
prog.c:25:3: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
   system("PAUSE");
   ^~~~~~
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
Case 4: Wrong output
Case 5: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.17
©2016-2026

相關問題

0 喜歡 0 不喜歡
18 回答
[練習] Coding (C) - 最新提問 1月 5, 2018 分類:Chapter 4: Arrays | 用戶: nat236919 (5.9k 分)
ID: 41054 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 6.9k 瀏覽
0 喜歡 0 不喜歡
46 回答
[練習] Coding (C) - 最新提問 12月 15, 2017 分類:Chapter 4: Arrays | 用戶: nat236919 (5.9k 分)
ID: 37580 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 11k 瀏覽
0 喜歡 0 不喜歡
20 回答
[練習] 克漏字填空 - 最新提問 12月 15, 2017 分類:Chapter 4: Arrays | 用戶: nat236919 (5.9k 分)
ID: 37578 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.5k 瀏覽
0 喜歡 0 不喜歡
18 回答
[練習] 克漏字填空 - 最新提問 12月 7, 2017 分類:Chapter 4: Arrays | 用戶: nat236919 (5.9k 分)
ID: 35798 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.1k 瀏覽
0 喜歡 0 不喜歡
0 回答
[Resource] 最新提問 1月 5, 2018 分類:Chapter 4: Arrays | 用戶: nat236919 (5.9k 分)
ID: 41053 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 13 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶