0 like 0 dislike
3k views

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

 

[Exercise] Coding (C) - asked in Chapter 4: Arrays by (5.9k points)
ID: 35804 - Available when: Unlimited - Due to: Unlimited
| 3k views

17 Answers

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

int main(int argc, char *argv[]) {
* *** * ** * x[5], i;
* * * * ** *****
* ** ********** * * * * * ** *
*** ** ** ** **** ** **** **** ** ** ** ** **** ** * * ** * &x[i]);
* ** * *** ** * ******* ** **
* ** ** * *
*** ** * * * * *
* *** *** **** * ** **** * ** ** * *
* ** **** ** * * * ****** * ** ****** ******* * ** * *
* * ** *** *
*** *** * ** *** ** ***** * 0;
}
100/100 answered by (271 points)
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 like 0 dislike
Hidden content!
#include ***** *
* * * * * * *** * **

int main(int argc, char *argv[]) {
** *** * ** int x[5], i;
*** ***
* * ** *** ** * * ** *
** *** **** **** * * * * * * ** * ****
* * * * * **
**** * *** }
** * * ***
*** ** * * * ** * *** ***
* * * * * ** *** * * * * * ** **** ***** *
** * ** ***** }
** * * return 0;
}
100/100 answered by (290 points)
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 like 0 dislike
Hidden content!
#include <stdio.h>
int main(){

** ** * *** ********** * * x[5], i;
***** * *** **** ***
    
**** *** * **** * * * * * ******* ********* ** *
*** * * ****** * * * ** * ** * * ***** * * ** ** ******* * * * &x[i]);
** ** * * * * *
* * ** ** * * *
**** * * * ** * ** ** ** * * **
** * * * * * * * * * ******** ** * ** ** * ** ** x[i]);
* * * * * **** * *** *
******* ****** * **
* ** * ** * * * * *** * 0;
}
100/100 answered by (269 points)
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 like 0 dislike
Hidden content!
#include <stdio.h>
int main(){

* ** * ****** ** * ** x[5], i;
* ** * * * * ** * * ** *
    
** *** *** ** *** * * ** * * * *
* * ** ***** ** * ****** * * *** *** ** *** * **** * * &x[i]);
** ** * * * *** ****
* * * * **** * * * **
*** * ** * ** ** * * ** * *** * ** *
* ** *** ***** * **** * * **** * * * * * * ****** * * x[i]);
*** ** * * * * *** * ***
*** *** * * * ** * *
**** ****** *** * ** ** 0;
}
100/100 answered by (243 points)
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 like 0 dislike
Hidden content!
#include <stdio.h>
int main(){
* * * **** * ** * *** * **** *** * ** *** * x[5], i;
* * ** **
*** *** ** *** ** *** ** * * * ** ** * ** ** ** *
    ** * ** ** * * * ** *** &x[i]);
**** ** * **
*** *** ** * * * * *** * * ***** * ***
* * * * **** ** ** * * * * *** * ****** * * **** ", x[i]);
* ** *** **** * * * *
* * * ****** * * * *** * *
**** * *** ** ** * ** ** ** 0;
}
100/100 answered by (220 points)
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 like 0 dislike
Hidden content!
#include *** * * *
int main(){

*** * * ** int x[5], i;
**** ** *** *
**** * * *
***** ** ** * * **
* *** * **** * * * ** * *** * * * * * ** * * ** *
* * * * ** }
* ** * ***
** * * **** ** * ** *** * * **
* ** ** ** * ** * * * **** ***** x[i]);
*** ** * ** * * }
* *** * *** *
*** * *** * return 0;
}
100/100 answered by (269 points)
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 like 0 dislike
Hidden content!
**** ** * ** *
** *** * * ** * *** *

/* run ** ** * the * * * * or add own * * * ** ** ** ****** or ** loop */

* ** * * *** * * {
* *** int **
* * * ****** a[0] = 4;
** * ****** * * = 2;
* * * = 3;
* * *** ** * * = 5;
* * ***** ** = 6;
** * *** *
* * *** * * ** ** * from 1 to ** ** * **
* * * **** * * * %d %d %d **** * ** ***** * *** * **** ** * ** *** ** * *
** * **
* * ** * int x;
** * *** * ** = 4; x * * 0; *
* ** * * * ***** * * *** **** *** * *
* * * * * }
**** ** ** ** * * * * * *** * ****

** ** * *
* * 0;
}
100/100 answered by (252 points)
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
Great job :)
0 0
However,     parts --a[0] = 4; a[1] = 2; a[2] = 3; a[3] = 5; a[4] = 6;-- seem unnecessary.
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.100.196
©2016-2025

Related questions

0 like 0 dislike
18 answers
[Exercise] Coding (C) - asked Jan 5, 2018 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 41054 - Available when: Unlimited - Due to: Unlimited
| 3.5k views
0 like 0 dislike
46 answers
[Exercise] Coding (C) - asked Dec 15, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 37580 - Available when: Unlimited - Due to: Unlimited
| 5.6k views
0 like 0 dislike
20 answers
[Exercise] Fill in the blank - asked Dec 15, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 37578 - Available when: Unlimited - Due to: Unlimited
| 1.8k views
0 like 0 dislike
18 answers
[Exercise] Fill in the blank - asked Dec 7, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 35798 - Available when: Unlimited - Due to: Unlimited
| 1.5k views
0 like 0 dislike
0 answers
[Resource] asked Jan 5, 2018 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 41053 - Available when: Unlimited - Due to: Unlimited
| 13 views
12,783 questions
183,442 answers
172,219 comments
4,824 users