0 like 0 dislike
8.1k views
Show more...
[Exercise] Coding (C) - asked in Chapter 12: Pointers and Arrays
ID: 38251 - Available when: Unlimited - Due to: Unlimited

edited by | 8.1k views

58 Answers

0 like 0 dislike
Hidden content!
* * * * *

void ** * * * ** a[], int n, int * * int * ** **

int * *
{
*** ** * ** int n, largest, ******
* ** *** * * ** *** *** * * * *** ** * will be entered
* * * * ** int a[n],i;
** * * * * ** ** *** ** * n integers ** ** * by spaces
* ** * for (i = 0; i < n; i++)
*** ** ** **** * * * ** * * * * * ***** ** *

* * *** * ** ** * ** n, *** * * * * ** * * * ***

** *** * * ** if (n == 0)
* ** * * ** * **** * ** * ** ** numbers were **** *
** * *** * else if (n == 1)
* *** ** * * * **** * * ***** * ** one number was * * * * ** * ***
* ** * * * else
* * * * * * * * *** *** %d, Second ** ** * * **** ***** *

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

void * *** **** * a[], int n, int ** int ****** **
{
** **** * * int i;
* ** * *** * * * = a[0];
** * * * ** **** * *** = 0;
* *** * *** for(i = 0 ; i < n ; i++)
* * **** * * ** * ***

* ** * * * ** * ***** ****** ***** * * > ** *
* * * * ** * * *********** * ** *** **
* * * * ** * ****** * * **** * * * ***** *** * ** * = a[i];
* ***** *** * ** ** **** * * ** *** *
***** *** *** **** *** ** * * = 0 ; i < n ; i++)
** ** ** * * ** ** ** * *** * * ** * * *
** ****** **** ** ******* * * ** ** *** * ** * > ** *** ** a[i] < * **
* * ****** * * * ** *** ** ** **** **** *** ** *** * * * ** * ** = a[i];
** *** ** * * * ** * * *** * * * ** * **** * **

*** ** * * ** *
}
answered by (-284 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include * * * * *

void * * * a[], int n, int *largest, int ** * *** *

int * **
{
*** * ** int n, largest, ** **** *
* * *** * **** ** * ** * * * * //Numbers will be entered
*   int a[n];
* * **** ******** ** * * * n integers separated by spaces
****** * * * * * * ** ** i;
*** *   for (i = 0; i < n; i++)
* * * * ** * * ** ** *
* * * * * ****** ****** ** ****** * *** * ***** * **** * * ** * * *
* * *** * * * *



** ** * ** *** * * * * * n, ** * * ** ** * ** **

* * * * * * * if (n == 0)
* * * *** * *** ** * **** * * * * *** * ** * * numbers were * ** * ****
* * * * else if (n == 1)
* * * ** * **** *** * * * * * * * * * **** * * * one number was entered. Largest: *** * * ***
* * *** * * else
*** * *** ** ** ****** * ** ** * ** * * ** * ** ** ***** *** * %d, Second Largest: **** *** * * *
** * * * return 0;
}



void * * *** a[], int n, int *largest, int ** ** *
{
****** * ***** * ** * * * *** ***
* *** * * * **** *** *** *** * **
** * *** * * * * * **** i,j;
** * ** * ** **** *** * * **
* * *** for(i=1; * * i++)
** *********** ** ****
* * * ** * ** *** ** * ** * ** * * * *** *** *** *
* ** *** ***** * * ** ** ** ** * ** * ** * *** *** **

* * * ** * ** }

* * *** **** * *** * for(i=0; *** * i++)
* ***** *** * ** *****
* ** * **** ** ***** ** ** **** ***** *** * * * * * ** * * * *** * * * *** *
* * * * **** ** * * * **** ** * * *** ** ** ** * *
* * * * }


}
answered by (-301 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include *** *** **

void * * * *** a[], int n, int *largest, int * *****

int ***
{
* **** * * int n, largest, * * ***
**** * * ** ** * * * **** * * ** *** //Numbers will be entered
* ** *** * * int a[n];
**** * * ** *** ** * * * * * *** * n integers separated by spaces
** * * * *** * * * * i;
* * * * ** for ( i = 0; i < n; i++)
* **** ** * * * * * **** * ** *** ** * * * ** **

* ** ** * * ** * ** * * n, * ** * ** *** ** **

** *** * *** ** if (n == 0)
** ** ** * **** * * * ** **** numbers were * * * *
**** * ** * ** * ****** //Print No numbers were entered.
* * * ** else if (n == 1)
** * * *** * *** * * * * ** ** one number was entered. Largest: * ** *
** * *** ** * ** * *** * //Print Only one number was entered. Largest:
* * * * * else
* * ** *** ** *   * * * ****** * %d, Second Largest: * ** ** ** *** ** *
* * * **** * * * * //Print Largest: , Second Largest:

* * * * * * return 0;
}

void * * ** * a[], int n, int *largest, int * ***
{
* **** * *********** * * i;
** * ** * ** * ***** * * * * **
** * * * *** *
* *** * * * * **
* * ** * **** * * * **** *** * ** **** * *** *** ** ** * * ** * * ** *
* * * * *** * ** ** * ** * ***
**** *** ** ** * *** ******** * ** ** * * * ** * ** * ** * ** ***** * * * *
** * * ** * * ** ** * **** *** * **** *
* ** ** ** * ** ** **
* * ** *** * * * **** * * * *
* * ** * * ***
* * * ******* ***** ** * * * * * ** * ***** ** **** * * * ** * ** ***
*** * ** *** * ** * * * * *** * *
* ** *** ** **** * * ***** * * * * *** ** ** ** * * * * * * *
**** ** * ***** *** ** * * * * * * ***
* * * ** ** * * ** * *

}
answered by (-255 points)
edited by
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: Wrong output
Case 2: Wrong output
Case 3: Wrong 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: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* **** *** * * ****

void * **** ** ** a[], int n, int **** * int *** ** *

int *
{
* ** *** int i,n, largest, ** *******
******* *** * ** ** **** *** ** * ** * will be entered
* * * * * int a[n];
** * * *** * * * * * n integers * ** by spaces
* ** * for (i = 0; i < n; i++)
***** ** * ** * ** *** **** ** *** * * * * *

** ** *** * * n, ** ******* * ** ** ****** *

****** * ** * if (n == 0)
** * * ** *** * *** * * * * ** * numbers were *** *** ***
* ** * *** **** ** ** *** //Print No numbers were entered.
* * *** else if (n == 1)
*** ** ** * * * * * ** * * one number was ****** * ** * *
* ** *** * ** * **** * //Print Only one number was ** * ***
* * * else
* * * **** ** * ** ** ** *** * ** ** ** %d, Second * *** * * **** * ****
*** * * ** * **** * * * //Print * *** , Second * * **

* * *** return 0;
}

void ** * * a[], int n, int ** * int * * *
{
* *** * * ** // Your code here (Using pointer to finish)
** ** * * int i;
** * ***** ** = ** * *** = a[0];
* ** * ** * * ** * * * *
** * * *** *** ****
** * ** * * ** *** *** ** ** ** * ** *** * * * **
** ** **** ** **** * ** **** ** * ***
** * * **** * * ** ** * * * * ** ** *** * * * * ** **** * ** * * *** = ** * *
* ** * * ** ** * ** ** *** * * ** *** * * * *** *** * * ** ** * = ********
* ** * * * * * * * * * * * **** *** * *
* * ** *** ** *** * * *** * * *** *** * * * ** ** *
* * * * * ** * * ****** * *** ** * ***** * * * * * **** ** *** * ** *** * * * = a[i];
* * * *** ** ** * ***
}
answered by (-281 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include ** * * **

void * * * * ** a[], int n, int *largest, int * * ** *

int main(void)
{
** * * ** n, largest, * * *
*** ** * *** * * ****** ** ** * * &n); //Numbers will be entered
* *** ** *** * * * **** a[n],i;
**** *** * *** * *** **** * *** n integers separated by spaces
* ** ** * ***** **** ** (i = 0; i < n; i++)
***** * **** * ** ******* * *** *** * * * * ** ** %d", &a[i]);

** *** * * * * *** * **** *** **** * n, * * * ** ** ****

*** ** ** ***** * * ** (n == 0)
** * * ** *** ** * * * ** * ** ** ***** * * * * ** * * numbers were * ** * *
* ** **** ** ***** **** ** *** if (n == 1)
* * * * ** ** ** ** * * ** ************** * * * * one number was entered. Largest: * ** * *
* ** ***** *** ***
** * ***** **** * * * ***** * * * * *** * ******* %d, Second Largest: * ** ** * * *** * * *** **

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

void * * * * a[], int n, int *largest, int * *** **
{
** ** * * *** * i;
* *** *** * * ** * * * * = a[0];
* * * * * * * **** * ** *** = 0;
* ** ** * ******* *** * * = 0 ; i < n ; i++)
* ** **** *** ***** **** *
** * *** ******** ** ** * * ** ***** * * ** * * *** > *largest)
* * * * * ********* ** * *** * * ** * ****** *
* ** * * * *** *** * *** ** ******** ** * * **** * * * ** **** ** ** = a[i];
** ***** * * * * ** * ** *** *****
* * *** * ** * * *
* ** ***** ** * ** ** = 0 ; i < n ; i++)
** ********* *** *** ***
** * ** ** *** **** * *** * * ****** ** * > * * **** * * * *** * a[i] < *largest)
***** * * * ** ** * *** * * * * ** * *** * *** ***** * * **** ** * *** = a[i];
* **** * *** ****** *

}
answered by (-127 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include ** * * *

void * ** * * a[], int n, int *** * * int * ** * **

int * * *
{
* * ***** * int n, largest, * ** *
** ** **** * ***** ** * ******* * ** ** * will be entered
*** * * int a[n];
* * ** * **** ** * * **** n * * * * by spaces
* * *** **** for (int i = 0; i * * n; i++)
****** * ***** * * **** * * ** * *** * * * ***

* ** ** * *** *** n, * * ** * * * * ** ******

** * * * * if (n == 0)
**** * ***** *** * ** ** ******** * numbers were * * *** **
** ** ** * else if (n == 1)
*** *** ** **** ** * * ****** * * * * ** *** * one number was entered. Largest: ** ** ** * *
* ** * * else
** * * * ** * * * ***** * * * *** %d, Second * ** ** ** *** * * ** *
* *** * return 0;
}

void * * * ** *** a[], int n, int ** int ** * *
{
** * * * *** ** * * i;
** * * ** *** ** ** = a[0];
* *** * * * ** ** * * = 0;
*** ** **** * * * ** * = 0 ; i < n ; i++)
** * * *** * * * * * * *
** ** * * ***** **** * *** ** **** * ** *** * * * ***
*** ** * * * ****** ** ** * * * * ** * * * * * ** * * * * * * ** ** = a[i];
* **** * * * ** ** ** ***
********** * ** * * * * = 0 ; i < n ; i++)
* * ** * * ***** ** * *
* ** **** * * * **** * * ** * ** **** * * * * *** *** *** ** a[i] < ** *
*** *** * *** * * * ** * *** * ** * ** * * * * ** ** * ** **** * * = a[i];
** * *** *** * *

}
answered by (-255 points)
edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include *** * * **

void * ** * * * a[], int n, int *largest, int * ** ***

int *
{
* * ** ** int n, largest, * *** *
**** * ** * * *** * ******* * * * * //Numbers will be entered
*** * **** int a[n];
*** **** *** * ** ** n integers separated by spaces
* *** * * *** * * * ** i;
** * * ** for ( i = 0; i < n; i++)
* ** * *     * ** ** * ** ** ***

* **** * ** * * *** ** n, *** * *** * * ** *** ** * *

** * * ****** if (n == 0)
** *** ** **** ** * ** * * * **** number were * ****** *
** * * ** ****** *** //Print No numbers were entered.
** ** *** else if (n == 1)
* * * ** * **** *** * one number was entered. *** * * ** * * *
**** * * * * ** *** * //Print Only one number was entered. Largest:
* * ** else
* * * * ** * ** * * ** **** ** Second * **** * ** * * ** **
** *** **** * * * *** //Print Largest: , Second Largest:

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

void * * *** ** * *** a[], int n, int *largest, int **** ** * *
{
*** * * ** *** * * ** i;
* * * * * * ****** ** ** ** *
* ***** * * * ** * *******
* *** * * * * ** * *
*** * ***** * *** ****** * * ** * ** ** * ***** *** * * * *
* *** ***** * ***** * *** ** ** *** *** ***** * ** ***
* * ** **** ** * * * ** * ***** **** *** ***** ** ** * *
** * ***** ** ** **** * * * * *******
* *** ** ** **** ****
** * ** * * **** ** * * *
** * * * * * *
* * ** *** ** ** ****** * **** ** * *** * ** ** * *** * ** * * * * * * ** * ** * * * ***
** ** **** *** * ** * *** ** ** * * * * ** * * *
** ** ****** ** * * ***** ******** * ** * * * * * ****** * ** ** ***
**** * * * ** *** **** * * ** * * * * * *** * ** *
* ****** * * *** * ** *

}
answered by (-255 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!
* * *** ** ***

void **** ****** a[], int n, int *** int ** ***

int ** **
{
** * * int i,n, largest, *** *
** * ***** * ** * ** ** * * * will be entered
* ** *** int a[n];
** * * ***** **** *** *** n integers by spaces
** * ** ** for (i = 0; i < n; i++)
** * * *** * * ** * ** * * ** ** ** * *

** * * ** ***** * n, * * * * * *** * *** * * **

* *** * * * ** if (n == 0)
*** *** *** * ** **** *** * * **** * numbers were ** * *
* * ** *** ***** ** ** //Print No numbers were entered.
* * * * * ** ** else if (n == 1)
**** ** ** ** * * * ** one number was **** *** * **
*** * ** ** ** * ** ** //Print Only one number was ** ** * ***
* else
* * ** * * * * ** %d, Second *** ** ** * ** *** ** * **
** * * *** ** * *** //Print , Second * * *

** * * ** return 0;
}

void * ** * a[], int n, int *** ** int ** **** ****
{
** **** * * // Your code here (Using pointer to finish)
* * * ** **** * int i;
* * ** ** * = * * *** = a[0];
* * ** ** * *
** ** ** ** **** *** **
* **** * ** ** ****** ** *** * * ** * * *** *********
******** * ***** **** **** *** ** ** * * ***** * *
* * ** * * * * * * * * * ***** * * *** * * ** *********** * ** * * * * = *
* ****** ** **** * * ************* ** *** * *** ** ** ** * ***** ** = ** ****
* * *** ** ***** * *** * * ** * * * *** *
* *** * * *** * *** ** * ** * * ******* * ** ***** * * * ** *** ** ** ** ******* * * ********
* * **** ** **** * ***** * * * **** * ** * **** * * ** * * **** **** ** ** * ** * ** * = a[i];
* * * * * ** * *** *** * ****
}
answered by (-281 points)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * *** ***

void ** * * * * * a[], int n, int *largest, int * **

int *
{
***** * * ** int n, largest, * ****
** * ** ** *** ** ** * * * *** //Numbers will be entered
* ** ** int a[n],i;
**** * ****** * *** * ** n integers separated by spaces
** * * for (i = 0; i < n; i++)
**** * * **   * * * * * * *** * ** * * ** *

*** * **** *** ****** n, * ** ** * *** ***

**** * * ** if (n == 0)
** ** ** **** * * *** * * ** * ** * numbers were * *** *
* *** else if (n == 1)
**** ** ** ** **** * * ** * ** one number was entered. Largest: * * *** a[0]);
* * * * else
**** *** ** *** **** * * * * ** * * * * %d, Second Largest: ** * largest, *** * * ** *

* ** **** return 0;
}

void * ** ** ** a[], int n, int *largest, int ** ** ***
{
** *** *** int j;
* * *** ** * **** ** *** * * * * * ** *
* * ***** *** * * * *** * * ******* {
* *** * * **** ***** *** ***** **** * *** * * * * ********** * * * ** * {
** ** **** * * *** **** ** *** ** ** ** * ** ** * ** *** * ** **
** *** ***** * * * ****** ** *
* * * ****** *** ******

** * ** ********* * * ****** ****** * {
**** * ** ** **** ** **** * ** ** ** * **** ** ** ** *** * * * * * * * * ** ** *** * {
*** *** * ** ******** ** ** **** * * * **** * * * ******* * * ** * ***** **** ***
* **** * ** *** ** ** **** ** ** * ****** ** * *
* * * ** * * ** * * ** ****
}
answered by (-120 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * *** * *
int i;
void * * ** a[], int n, int *largest, int * ** *

int main(void)
{
** * ** *** ** ** *** n, largest, second_largest;
* ******* ****** *** ** ** * * * &n); //Numbers will be entered
* ** * * ** * a[n];
** *** ** *** * * ** * n integers separated by spaces
* ** *** * * ** ** * i;
* ***** **** ** * * *** * (i = 0; i < n; i++)
* * * * ** * *** * * **** *** ** ** * * * %d", &a[i]);

* * ** ****** * * **** *** n, ** ***** * * ** *** * *

* ** * * * *** * * * (n == 0)
* * * * * * ** ** * ** *** * ** * * * Your code here
* **** **** ** * * * ** * * *** * *** ** ** numbers were ** * *
*** **** ** * * * * *** No numbers were entered.
** * *** * *** * * ** * * if (n == 1)
** ** * *** **** *** ** ** * *** * * ****** * Your code here
****** * * * ** * * * ** ** *** ** ****** * ** * * ** one number was entered. Largest: ** ** ** ***
* * * * * ** ** ** Only one number was entered. Largest:
* ** * * * **** ****
** * * *** * * * * * * *** *** ** ** * Your code here
*** *** * ****** * * * * ** ** ** *** ** * * ** * * * %d, Second Largest: ** * ** ** ** *
** *** * *** * * ** * * * Largest: , Second Largest:

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

void *** ** * * * a[], int n, int *largest, int *second_largest)
{
** * **** * **** Your code here (Using pointer to finish)
* * * **** * *** ** * ** ***

** * * * **** ** * i<n; i++)
* * ** ** ** * * *
*** * * * ******* ** * * * * * ** * ** * *
** * **** *** * ***** * **** **** * * * *

** * ** ** * * * * ** **** * * * *** *** * * * ** **** * * * ** ****
* ** ** ****** * * ** ** ** ** ****** ** ** *
****** ** * * ** * **



********* * **** ** * * * * i<n; i++)
*** * ** *** * ****
* *** * ****** ** * * * * * * * * ** * * **** * * * *** * * ** * ** ******
* * * ***** * ** *** * ** *
* * * ***** ** **** ** * ** * * ** * * ** * *** * * * * ** * * * *



* ****** * * ** *** * ** *** * ** * **


* * * ***** ** ** * *


}
answered by (-336 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.99
©2016-2025

Related questions

0 like 0 dislike
30 answers
[Exercise] Coding (C) - asked Dec 21, 2017 in Chapter 11: Pointers
ID: 38255 - Available when: Unlimited - Due to: Unlimited
| 4.9k views
0 like 0 dislike
58 answers
[Exercise] Coding (C) - asked Dec 21, 2017 in Chapter 12: Pointers and Arrays
ID: 38252 - Available when: Unlimited - Due to: Unlimited
| 7.2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users