0 like 0 dislike
5.7k views
Show more...
[Exercise] Coding (C) - asked in Chapter 4: Arrays by (5.9k points)
ID: 37580 - Available when: Unlimited - Due to: Unlimited
| 5.7k views

46 Answers

0 like 0 dislike
Hidden content!
#include ** * * *** *

int main(){
** * ** number[5]; // Do not change
** * size = 5, * *** // Do not change

** * * * * * * ***** // Do not change
** **** * * * * ** * *** * * * ** ** * * *** * // Do not change
* *** // Do not change

*** ** *** * {
** * * ** *** ** **
* ****** *** * * *** * *** * * {
* **** * **** ** ** * *** ** * * ***
* * * ** * **** * * *****
*** ** * ***** * * * * * * * *** * *
* * * * * ** ***
* * *
* ***
****** **** * * ** * {
* *** * **** ** * * ** *** * ** * ** **** *
** * ****

*** * * 0;
}
100/100 answered by (273 points)
0 0
prog.c: In function 'main':
prog.c:11:6: error: 'i' undeclared (first use in this function)
  for(i=0;i<5;i++) {
      ^
prog.c:11:6: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(){
* ** *** * ***** * number[5];
* * * * * ***** ** size = 5, temporary;
    
* * ** * * ** ** * ***** i=0;i<size;i++){
* **** * ** * *** ** * **** ** *** * * ** ** *** * * ** ** ***
** * *** * ** ** * * *

* ** **** * **** * * * *** * j = 0; j < size; j++){
* ** ** ***** * ** *** * * * * * ** * * ** *** i = 0; i < size-1; i++){
**** ** *** * * **** * * ** ** * **** ** * *** *** * * ** * ****** * * ** * > number[i+1]){
* * **** * *** *** ** * **** * *** ** **** ** * * ** ** * * *** * ****** * * ***** ** ** temporary; * * ** * * * ** * *** *** * ** ***
* **** **** *** * ** ******** * *** ** *** ** * * *** *** * **** **** ** * * * * * * *** * = number[i];
*** **** * *** ** * * ** * * ** * * ** * ******** ******** *** * * * * * ** * ***** = number[i+1];
* **** * * * * *** ** * * * ** *** * ****** * * *** * * * * ** * *** ** * * * * ** * ** = temporary;
** *** *** * * *** **** ****** * * * * * * * * **** * *** **
****** *** ** ** *** * * **** * ****** *
** ** ** * * ******
* * * **** * ** * *** i = 0; i < size; i++){
* * * ******* ***** * ** * * * * * ***** * ", number[i]); * ** ** *** ** **** * * ** * ***** **
** * * *** ***
    
**** ** *** * * * * 0;
}
100/100 answered by (220 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include ** * * *

int main(){
* *   int number[5]; // Do not change
* *   int size = 5, temporary; // Do not change
** * ** *  
    for(int * * * // Do not change
******* *** * * * * * * ** * ** * * ** ** ** ** ** *** // Do not change
** ** * * } // Do not change

*   // Your conditions start from here
* *** ** * * ** *** * ***** j = 0; j < size; j++){
* ***** * * * * ****** *** * ****** *** ****** i = 0; i < size-1; i++){
** * ***** ** * * * **** ** * * *** * ** * **** * *** ** *** ** * > ** ******
* ** * *** ** ** *** * ** **** ** * * * * *** * ****** ***** * ****** * ** * * ** ***** temporary; * * ** ** ** * * ***** * * *** * *
***** **** ** * * * **** * *** ***** *** ** ** ** *** * * ** * ** * * * ** *** *** ** * * *** ** = ****** **
*** **** * ** ** ** *** * * * * ** * ** *** *** *** **** * * ** ** ** * * ** * **** *** * * = * *** *
*** ** *** ****** * * **** ** ** ***** * ** ** ** * * * ** * *** **** ** ** *** * ** = temporary;
* ***** ***** * **** ****** ** ** ** *** *** *** * * * * * * *
** *** * ** * ** **** * * **** * * * ** *
** * ** * ** * *
* * * * *** **** ** **** * i = 0; i < size; i++){
** * * * * * **** ***** * ******** * * * * *** *** **** * * * * ** **** ** * ******* **
*** *** * *** **** **
* *** *  
** * * * * *** *** **** 0;
}
100/100 answered by (283 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * *** *** *

int main(){
* * *   int number[5];
    int size = 5, temporary;
   
    for(int * * *** ****
        **** * * * * * * * * * **
* *   }
* * * * *** * * ** * j = 0; j < size; j++){
* * * * *** **** ** * ** ***** *** *** * *** **** from left to right */
** **** ******* * ** * * * ** * ** ******** * i = 0; i < size-1; i++){
* ** * ** * *** * * * ** ** *** ** ** ** * * ** ** ** * *** * *** i-th element with its neighbor to check if they are in order */
** ** * * * ** ** *** * **** ** * * * * * * *** ** * * ** * *** * > ** **
** ** ** * **** * ** * ** * * * * ** **** ** **** *** ** ** * *** * ** * * * ** * ** exchange the values of x[i] and x[i+1] */
******** ** * * ** **** **** * * * *** ***** ** * * * * * * * * **** **** *** ***** * * temporary; ** ** * **** * * * *** ** *
* * * * *** ** * * ** ** * ** * * * ** * **** ** ** * ** *** * * * *** *** ** * * *** = ** *
* * * * * ****** ** * * *** * ** * *** * * * **** ****** ** *** ** ** * * *** * ** * * = *** * *
*** * * * ** ** ** * ** * * ** ** ** ** *** * * * *** ** * * * * * ** * * * = temporary;
* * ** * * ** ** * * *** ****** * ** * ***** * **** *
* *** * * *** ** ** * * ** * * *
** ** ** * * ****
* ** * ****** ** * * * ** *
**** ****** * ***** *** * print the array */
* ** * ***** ** ** ** i = 0; i < size; i++){
** ** * ** ** * * ** * ** *** * * * *** *** * *** * * * * *** * *** ** ** * ** ** ***
** * * * * * * ** *
* *  
* * **** ***** ** 0;
}
100/100 answered by (153 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
prog.c: In function 'main':
prog.c:30:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("PAUSE");
     ^~~~~~
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
**** * ** ****** ** * ** x[] = {77,22,88,11,22};
** ** * * * ** ** * size = 5;
    
** ** *** * ** ** * * print the array */
***** *** ***** * * ** * ** i = 0; i < size; i++){
*** ** **** ** * ** * * ****** * ** * ", x[i]); ** ** * ** * ******* ** ** *
* ** * * ** ** * * * *
* * * * * ** * * * * * ***** * * * *
** * * ** * ** * ** **
* ** * *** * * I need this to happen size-times */
* * * **** ** * ****** j = 0; j < size; j++){
*** ****** * * * * ** * * ** ** * **** * **** from left to right */
** * * ** ** ** *** *** ** * * * ** * * * i = 0; i < size-1; i++){
*** * * ** ** **** * ** ** * * **** * ********* ** * ****** **** * * i-th element with its neighbor to check if they are in order */
* * * ** ** * * * ** ** * * * **** **** ** * *** * ** > x[i+1]){
* * ** * ** * * * ** ***** ** * ***** ** ** *** ** ** * *** * * * ** **** *** * * *** * exchange the values of x[i] and x[i+1] */
** ** ****** ** ** **** * * * * * ** *** * * *** ** **** * ** * ** *** ***** ****** temporary; * * ** * * * ** * * **** * ****
* * ******** * *** *** * *** ****** ** ** * *** * * ** * * **** ****** *** ** ****** * ** * * = x[i];
**** * *** * *** ** * * *** ****** **** * *** ** * *** *** *** **** * *** ** *** * * = x[i+1];
* *** * * *** * ** * **** ** ** *** * * * * * * * * * * *** * *** * * * * = temporary;
* ** ** *** ** * * * ** * ******** * ** * ** * * ** * ** * ** **
**** *** * ***** **** ** * *** * *** * *******
** ** ** * *** ***
* ***** * *******
** * ** ****** * ** * print the array */
* * * ** * * * * ** *** sorting: \n");
** * ****** ***** * ** i = 0; i < size; i++){
* **** *** * *** ** **** ** ********* * * *** * ** *** *** ", x[i]); * * * **** *** ** * * * * * * *
* *** * * ** * **** *
* ** * *** ** ** * * ** **** **
****** * ** **** * ***
* ** ** * *** ** * *
****** * ** * * ** * * * * * *
* * * **** *** ** * ** * ** *** **  
*** * **** ** * * ** * *** * 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
* *** * ** * **** x[] = {77,22,88,11,22};
*** * *** * * *** *** size = 5;
    
* ********* * * * ****** * print the array */
*** ** ** * *** * **** * *** i = 0; i < size; i++){
* **** * * * * ** ** ****** * ** ** * * * *** ", x[i]); * ** * * * ******* * ** ** **
* * ** * **** * *
** ** ** * ** * ** * ** **** * ** * **
****** * * ***** * *** *
* ** *** * *** ** ** *** I need this to happen size-times */
* * * ***** ** ** ** ** j = 0; j < size; j++){
** * ** * * * ******* * * **** * *** *** * * from left to right */
** ** * *** * ** * ****** *** * * * * **** i = 0; i < size-1; i++){
** ***** ** *** ****** * * ** * ******** ***** * * *** * *** ** * i-th element with its neighbor to check if they are in order */
* ** *** * * ** * ****** ** * ** *** ** **** ** * ** * ** * ** * > x[i+1]){
** *** * * **** * * ** *** ** ** * ***** *** * * **** ***** * *** * * * * ** * ** ** * * exchange the values of x[i] and x[i+1] */
* ** ** * * ** *** * * ** ** * *** **** * *** *** * **** * * * ** *** *** ** * * ** temporary; *** * **** * * ***** ** *** *****
* * ** ** * *** ** * ** * **** ** **** *** ******** ***** *** **** ** * * ****** ** * ** * * = x[i];
** ** * ** ** * ** * * * * * * *** ** * ** * *** ** * *** * * * *** ** *** * * * *** = x[i+1];
* ** ** *** ** ****** ** * ** **** **** *** ** *** * **** ********* * ** * ** * ** ***** ** ****** * = temporary;
* * * * *** *** ** * **** ** **** * ** * ** * * * ** * ** ** * * ** * *
*** ** ******* *** * **** *** ** ** **** * ** ** * *
** *** * * * *** ***
** *** * * *** **
**** * * ***** * * print the array */
** * * * * ** * ** *** * * *** sorting: \n");
* * * *** ** * *** ** i = 0; i < size; i++){
*** ** *** * * ** ** * ** * *** **** * ** * * ", x[i]); * * *** *** * **** *
* * * * * * ****
*** * **** * ** * * ** ** ** * * ** * * **
* * ** * ** * **
** * ****** *** * * *
**** ***** * *** ******* ** * * *
*** *** *** * * ** *** ** * * ** * *  
** **** ** ** * * ** 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
**** * * ** ** ** * x[] = {77,22,88,11,22};
*** ***** *** ****** size = 5;
    
* ** **** * **** * ** * * print the array */
* * ** ** ******* * **** ** i = 0; i < size; i++){
****** * * * * * * ********* ** * * * * ** ** *** ", x[i]); * **** ** * * * * * * *
**** * * * ** ****
* ** * ** * * ** * ** ** * *** * ****
* * * * ***** *** ** ***
** *** *** * *** **** I need this to happen size-times */
* * * *** ** ******* * * ** j = 0; j < size; j++){
** * ** * * * ** ** * ** ** *** * * ** **** from left to right */
* * ** ** * ** ** ** ** *** **** *** ***** * i = 0; i < size-1; i++){
* * ** *** *** * * ** * * * *** ** * **** *** ***** * * *** * ** i-th element with its neighbor to check if they are in order */
** ** ** * * ****** * *** *** * * * * * * * *** * **** * * > x[i+1]){
*** ** **** * * **** * * ** ** * ** ****** * *** *** **** **** * * *** ** * **** ** exchange the values of x[i] and x[i+1] */
* ** ** *** *** * * *** * * ** ** * ** ** *** * * * * * * ** * * ** ** ** * * ** **** temporary; * ***** * ** * * * ****
** * * ** ** * * ** * * ***** * **** * * ** * ** * * **** *** ** * **** ** = x[i];
* * ***** * ***** * * * * * * ** * ** * * * * * * ** ***** *** * *** **** * * * * * * = x[i+1];
** ** * * * * * *** ** ** *** * ** **** * * * ** *** *** * *** * *** * ** ******* = temporary;
* * * * * * * * ** * * * ** ** * ****** * *** ** * ** ** ** **
* ** ******** * *** ** * * ** * * * * ****
**** * ********** * * **** *
** * ** * ** *** * * *
** ** * *** * ** **** * print the array */
*** **** ** **** * ** ** * sorting: \n");
* ** * *** * * * ** i = 0; i < size; i++){
** ** ** * * * ***** *** **** ** * *** * *** * * *** * * ", x[i]); ** *** * * * * ** * ** * *
* * * ** ***** ** **** **
* ** ** * * *** ** * * ** * * **** **
*** ** * * *** ** *
* *** * **** * * ** *** *
* *** * * ** **** * * * * **** ***** ** **
** *** * * * * * ** * * ** * ***** * ** **** ** *  
***** * * * * * * * *** * 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
*** * * ** ** * * * ** x[] = {77,22,88,11,22};
* * ******** ** * * * ** size = 5;
    
***** ** ****** ** ******* print the array */
** * * * *** ** i = 0; i < size; i++){
* * ** * ** *** ** **** *** ** * * * ** ** * ** ** ", x[i]); * ** * ** * * * ** * * * *** * * *
**** ** * ***** ***
* * * ** * ***** ** ** * *
** ** * ** *
* ** * ** **** I need this to happen size-times */
* * * * * * *** *** * * ** * j = 0; j < size; j++){
** ***** ********* * ***** ***** *** * from left to right */
** ** * * * * * * * *** ** * *** ** *** * *** ** i = 0; i < size-1; i++){
* * ***** * ** ** **** ** * ** *** * **** ** * ** **** * * ** ****** ** i-th element with its neighbor to check if they are in order */
* ****** ** *** ** ** * * **** * ** ** * ** *** ** * * * ****** > x[i+1]){
** * * ** ** * ** *** ** ** ** * **** * * ** ****** **** ** ** * ** ** ** **** * exchange the values of x[i] and x[i+1] */
** *** **** * ***** * ** ****** * *** ** ** ** * ** * *** ** * **** * **** * * ******* ** * *** temporary; ** *** * ***** ** ** ****** * *
* * *** ** * ** * *** *** * *** ** * * *** * * * *** ** *** *** *** ** ****** * ******* = x[i];
* ** ** * * * * *** ** * **** * * * **** **** * *** * * ** ***** * * ** **** *** * = x[i+1];
* * * ** * ** ****** ** ** ** * * *** **** * * * **** * ** * ** *** ** ** *** * * * ** ** * * ** * * = temporary;
* * * *** * * * * ****** * **** ** ** * ***** ** ** **
* ** *** ** ** * ***** *** * * * * ** * * *
* * * **** ** **** * ** ****
** * * ** * * * ****** *
* * ** * * ** * * *** * print the array */
* * ** *** ** * * ****** * * ** sorting: \n");
* ** * * * ** *** * *** * ** i = 0; i < size; i++){
** ** ** * * * **** * *** * ** ** **** * * ** ", x[i]); * * * * * * * **** ** * * ***
** **** ** * ** *** * * * *
*** * **** * *** * * ***** *** * ** **
* * * *** *** * * *
* * ** * *** * ** * *
** ** ** * * ** * **** * *** ** * ** **
** * ****** *** *** * * * *** *** **** * * *  
** * ***** ** ** * * 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
** * * * * * ** ** ** x[] = {77,22,88,11,22};
* ** * * * * ** * * **** size = 5;
    
**** * * * **** * ** print the array */
* *** ***** ** * **** * ** ** ** i = 0; i < size; i++){
* * * ** * ** * **** **** ** * * ***** * * * * ", x[i]); ** ** * * ** * * *
****** ** * * * ***
*** * ** * * * ** * ** ** * *** *** * * * * *
** *** ** * **** ** *
* * * ** * ** ** * I need this to happen size-times */
**** * *** ** * * * j = 0; j < size; j++){
*** *** * * * *** * * ** * * * from left to right */
* ** * * ** **** **** ** ******* *** * * i = 0; i < size-1; i++){
* ** * * * ** * * * * * * ** * * * * *** * * *** * * * * * * * * * * * i-th element with its neighbor to check if they are in order */
** * ** ** **** ** ** *** * *** *** * *** *** * ** ***** *** * **** > x[i+1]){
* * * ** * * ** * *** * * * * * **** * * *** * * *** * * **** * ** ** * exchange the values of x[i] and x[i+1] */
* ****** * * *** * * * ** * ** **** * ** ********* * ***** *** ** * ** temporary; ** * *** * ** * ** ** *** *
* ** ** *** ** *** ** *** * ** ** ** * * *** * ***** * ** * * ** * * * *** * ** ** = x[i];
** * * * *** * *** ****** ** ** ** * * ** ** * ***** * *** * ** * ** ** = x[i+1];
**** ** **** * **** * * ** * ** * * * * * ** * * ** ****** * ***** *** *** * * * * * * * = temporary;
* * ******* * ** * ******** *** ** * ** * * * * *** * **
* ** ** * * * *** ****** *** *** * ** ** * * * ** *
**** ** ***
** *** ** ** * * **
* * **** ** ** * *** print the array */
*** ** * * ** * ** ** ** * sorting: \n");
* * *** ** *** * * * ** ** *** i = 0; i < size; i++){
* * **** * * * ** * ** ** ** ** * ** ** ** ", x[i]); ** * ** * * ** **** *
* * * ** * * * * ** *
** **** * * * * ** * ** * * * ***
***** * * ** * * ****
* ** ** ** ** *
* ** ***** ***** * ** ** * * ** ** **** **
* *** ** * ** * *** * **** ** *** * **  
** ** * ** *** * 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
** * * *** * * * **** x[] = {77,22,88,11,22};
** * ** ** * *** ** size = 5;
    
* * * ** * ** ********* print the array */
**** **** **** * * ** * * i = 0; i < size; i++){
** * * * * * * * ** * * * * * ** ** ***** ** ", x[i]); ******** * *** ********* * * **
*** * * ** * * **
*** **** ** ** * ***** * * *** ****
* * *** * * ***
* *** * * * ** * * ** * * I need this to happen size-times */
***** * ** ** ***** ** * j = 0; j < size; j++){
** * ** ** ** * ** * **** ** * * ****** *** ****** from left to right */
* * *** * ***** ** ** ** * * * * ** ** ** i = 0; i < size-1; i++){
*** ** *** ********** ** ** * * * * **** ** * *** ** * ** ** ** * * i-th element with its neighbor to check if they are in order */
* * *** * * **** * ** * * ** *** * * ** * ** * ** ** * * * * * > x[i+1]){
** * * *** **** ** *** * **** ** ** ****** *** ** ** * * * **** * *** ** *** exchange the values of x[i] and x[i+1] */
* * ** ** * ** * *** ** * ** **** **** * * * * * * * ** * ** * * * * *** ** * * * * ***** * ** temporary; ** * * ***** ** * *** ** * **
***** ** * * **** *** ***** ***** ** ******** **** ** **** ** * * * * * * * * * * = x[i];
*** * *** ** ** ** ** ** * ** *** * * **** * ****** * ** * * * ** ** * ** **** **** * = x[i+1];
* ** * * * * * **** * * * * * * * ** ** * *** ** * *** * * * * **** * * = temporary;
* * * ** * **** * ** * * ***** * * * ****** * * ** * ****
* ** ** ** *** * * ** * * ***
* * ** **** ** * * * ** *
*** * ** ** * * * * *
*** ***** **** * * *** print the array */
* * *** * ** * *** *** ***** *** sorting: \n");
*** *** ** * **** ** *** * *** i = 0; i < size; i++){
****** ** *** * ***** ** * * ** * ***** ** **** ** ", x[i]); * ** * ** * **** * * * * *** **
* *** * * * * * ** * *
* **** * * * * ** ****** * * ** *
** * * * *** ** * ** **
*** * * * * ***
** * * * ********* ** **
* * ** *** * * *** * ** * ** * ** * **  
* *** * *** * *** * *** 0;
}
answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.94
©2016-2025

Related questions

0 like 0 dislike
0 answers
[Resource] asked Dec 15, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 37571 - Available when: Unlimited - Due to: Unlimited
| 6 views
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
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
17 answers
[Exercise] Coding (C) - asked Dec 7, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 35804 - Available when: Unlimited - Due to: Unlimited
| 3k 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
12,783 questions
183,442 answers
172,219 comments
4,824 users