0 like 0 dislike
6.9k views

Finish the function compute_GPA below. The function should return the average of the grades (assume that A=4,B=3,C=2,D=1, and F=0). The grades array will contain letter grades (A,B,C,D, or F, either upper-case or lower-case 大寫小寫), n is the length of the array

寫compute_GPA函數。函數會return成績平均(A = 4, B = 3, C = 2, D = 1, F = 0)

#include <stdio.h>
float compute_GPA(char grades[],int n)
{
   /*INSERT YOUR CODE HERE*/


   /*END OF YOUR CODE*/
   //The function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

   /*INSERT YOUR CODE HERE*/


   /*END OF YOUR CODE*/

   printf("%g",compute_GPA(G,n));

   return 0;
}

Example input: 

The first input is the number of elements need to compute GPA (4); The array values follow; 

第一行是成績數目,第二行是成績(A/B/C/D/F)

4
A B C D

Example output

2.5

Remember: You may correct the cases, but your code always be revised!

[Exercise] Coding (C) - asked in Chapter 9: Functions by (5.2k points)
ID: 37278 - Available when: 2017-12-14 18:00 - Due to: Unlimited

edited by | 6.9k views

50 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
float compute_GPA(char grades[],int n)
{
    int i;
    float sum=0;
***** * ** *** *** * ** ** * ***
* *** ** * * * ** **** * ** * ** * ** * * *** *
* * * ** **** * **** ** ** * *********** ***
*** * ** **** * * ** * ** * ** ** * * * * ** * ** * * ** 'A':   sum+=4;
* ******* ** * ** *** * * * * ** * ** **** ****** *** * ** * * ** * * * * * * * * * *** * ** * ** **
* * ** * *** **** ** * * * **** * ** * ***** * * *** * * ** * * * * 'a':   sum+=4;
**** * * ** ** ** *** ** ** * * ** * ** ** *** * ** * * ** * * * *** ** * * * ***** * * * *** * * ** * * ** * * ******* ** ** *
* **** * * * *** ** ** * ** * ** ** *** * *** **** * * ** 'B':   sum+=3;
** * ** ** * **** ** * ** * **** ** ***** *********** * **** * * * ** * ** ** * **** ** * **** ** ** * * ** * *
* ***** * ** * ** * * * ** ** * * * ** ** ** * * ** * 'b':   sum+=3;
** ******* **** * * ***** **** ** ** * * ** * * **** * * ** * ** * ** *** ** * * ** ***** * * ** **** ** *** * ** * ** * * ** * ***** *
* *** * ** * ****** *********** * * *** ** * ** * * ** **** **** * 'C':   sum+=2;
*** * **** * * * * * * ** ** ** * **** * * ** * * *** * * **** ** ** ******** * **** *** * ** * *** * * * * **
* * * *** ***** * **** * * ** * * *** * ** ** ** *** * * 'c':   sum+=2;
****** * * ** * * * * * ***** ** * ***** *** * * * ******* ** * **** **** ** * * * * ** * * ** * * ** * * * *** ** * * *
** *** * * *** ** * *** * ** *** ** ** ** * ** *** *** * ** ** * 'D':   sum+=1;
*** * * *** * * * **** * * **** * * **** **** * * ** * *** ** * *** ****** ** ** *** * * * * *** * * * ** * ** ** ******* ***** *
** * *** *** ** ***** * ***** *** ******* * * ** ***** * * 'd':   sum+=1;
* **** ** * * * * * ****** ** *** * * * * ***** * * * * *** ** ** ** * ** * ** * *** *** **** ** * ** **** ** *** *** * *** ** *
* ** * *** * ***** ** ** * * * *** ** ** * * * ****** * * * ** ***    sum+=0;
* * * * *** ** ********* * ** ** ** * ** *** ** * ** *** * ** ** **** * * ******* * * * * * * * *** * * ** * * * ** ******
** ** *** * * * *** ** ** *** * **** ** ** *
    }
    sum=sum/n;
    return sum;
}

int main(void)
{
    char G[100];
    int n,i;
** ***** * * * * * * *** * *** ",&n);
    gets(G);
    //puts(G);
* ** * * *** * **** ** **** *
* * * * *** ** *** ** *** *** * ***** *** *** *** **** *** *** **** * *

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

    return 0;
}
answered by (54 points)
0 0
prog.c: In function 'main':
prog.c:38:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(G);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccSrXay5.o: In function `main':
prog.c:(.text+0x1a8): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include <stdio.h>
float compute_GPA(char grades[],int n)
{
* ** * * ** ** ** ** * * YOUR CODE HERE*/
* * * ** * ** *** *** sum;
* * * **** * ** * * i;
* *** ***** ** ** * * ** * *** ** *
*** ** ***** * **** **** * * ** * *** ** * * * ** ** * * ** * * * **
* * ***** * * *** **** ** *** ***** * ** **** ** *
* * * ***** ** ** 'A':
******* * *** **** ** ** * *** ** * ****** 'a':
* ***** ** * ****** ** ** * *** * ****** *** * * **** ** * * * * * ** * ** **
* *** ***** * * ****** * *** ** * ***** ** * * ** * * * ****
** ** ** * * ** ****** * *** * ** * ** 'B':
** ** ** ** *** * **** ** * * ** 'b':
** * **** * ***** * ***** * * ***** * ***** * *** *** ** * * **** *
** * * * ** * * * * ** * ** ******* * ** *** * ** ** ******
** ** * ** *** ** **** * * * * * * 'C':
** * * *** * ****** ***** * * * **** **** * * * * 'c':
* **** * ****** ** **** * ** * * **** ** ** * * ** ** * * ** * ** ** ***
* * * * ** * ** ****** **** * *** ** ** * * * *** ** ** * ** ****
**** * ** ** ** * * * **** * * *** ** ** * ** * **** 'D':
* **** ** * * ** ** ** * ******** * * 'd':
** * ** **** ****** * * ** * ** * * * ** **** ** * ******
* ** * **** ** ***** **** * * * * *** * ** * * ** * ** *** ** *
*** *** * * * * ******* * **** ***** * ** ****
* ** * ** *** *** *** ** *** ** * ** * ** *** * * * *** * * *****
* * * * * * *** *** **** * * *
* * *** * * *** ******* *
** * ** *** * *** sum/n;


   /*END OF YOUR CODE*/
   //The function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

** * * * *** * YOUR CODE HERE*/
   int c;
   char temp;
*** ** ** ** * *** ** *** &n);
   for ( c = 0 ; c < 2*n ; c++ ){
* * *** *** * ** * **** * ***** * * ** * * * * * * ** ****** * ***
** **** * ** * *** ** * * * ***** ***** ** *** * ** * ****
*** **** *** ** * ** * ** ******** **** * *** ** * * ** * **
**** * * * * * * * ** **** ** ** *** * ** *
   }
   /*END OF YOUR CODE*/

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

****** ** *** 0;
}
answered by (-116 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 <stdio.h>
float compute_GPA(char grades[],int n)
{
***** * ** ** YOUR CODE HERE*/
**** * *** * * * sum;
* * ** * * * ** ** ** * i;
* * * * *** * * *
**** **** * * *** * *** *** ** * ** * * * * * * ** **** * ****
*** * ****** * * **** * * ** * ***** *** ** *** **
***** ** *** ** * * ** * ** * 'A':
** ** ** * ** * ** **** * * **** * * ** *** * ** ** * ** * *
* * ** * ** ** * ** * * ** * ** ***** *** * ** ***** * * *
** * ** ** ** ** * * * * * * ** *** 'B':
* * ** *** ** * *** ** * * * *** ** ** * ** * ***** * * **
* * ** ** * ** ** * *** * * **** * * **** **** ** * **
* * * *** ** ** ** * *** * ***** * * ** *** *** 'C':
** ** ** ** **** * ** * * *** * * * *** ** ****** **** * * *** * *
****** * * *** ** ** ** * ** ** * * ** * ** **** * ** ** **
** * *** * ******* *** * * *** ** ** ***** *** 'D':
* *** * * * ********* ** *** * ** *** ** ** * * *** *** * * *
* ** * ** ** * ******** *** * * * * * * ****** * *** * ** *** * ***** *
***** * * ** ** * ** **** *** * * * *** **** *
* *** * **** *** ****** **** ** * * * *** * ** * * ** ** * * **
**** **** *** * * * * * ** * * ** * *
* * * ***** ** *
* * ** ** * ** ** **** **** sum/n;


   /*END OF YOUR CODE*/
** * ** ** * * **** function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

** ** **** * *** **** * YOUR CODE HERE*/
   int c;
   char temp;
* **** *** * **** * * **** *** &n);
   for ( c = 0 ; c < 2*n ; c++ ){
*** * * ** * * *** *** ***** * ** * ** *** * ** ****** * *** * *
**** *** * ***** * ***** ** ********** ** ** **
* *** **** * **** *** ** * ** ** * * ** * *** * **** * * * *** ** * * ** **
** ** * ****** * * * * * *** * * * *** ** *
   }
   /*END OF YOUR CODE*/

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

*** * *** ****** ** 0;
}
answered by (-116 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
float compute_GPA(char grades[],int n)
{
* ** *** * * * ** a;
* *** ** * * * g=0;
* *** * ** * ** A='4',B='3',C='2',D='1',F='0';
* * ** ******* ****
***** ** **
* ** * * ***** * * * ** ***** * * **** **** *
** * * **** ** * * **
* *** ** * ** *
* * ***** * * *** g;
}

int main(void)
{
* *** * *** ****** G[100];
** * * *** ** * * n,i;
* * * * * **** * *** * *** *
*** * * * *
   {
*** *** * **** ** * * * * * ** * *** * * *** * *****
***** * ** * * ** *
**** * * * ** * ** ** * * * *
* * ** ****** * *** 0;
}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include * ** * * *
#include <ctype.h>

float compute_GPA(char grades[],int n)
{
** **** ** *** ** * YOUR CODE HERE*/
**** *** * * *** * * * i,j;double sum=0;
**** * *** ** * ** ** (i=0;i<n;i++)
* * * * * * * *** **
* * **** * * * ** * **** * ** * ** * ** * * * ** (grades[i]=='A')
******* * * ** *** * * * ** * ******** * *** * * * **** * **** *
** ** *** ** * ** ** **** * ** * ** * if (grades[i]=='B')
* * * ** **** * *** ** * ** ** ** ** *** * *** ***** * ** * ***
* *** * * ** ** * * * ** * * **** * * * ** * if (grades[i]=='C')
** * * *** * ** * * *** * * ** * **** *** ** * * * * *****
* * ** ** * * **** **** * *** * if (grades[i]=='D')
**** * * **** ******** * ** * **** * *** ** * * *** * ** * * **** * ***** * *
* ** * ****** ***
** *** ** * * * ** ** *** sum/n;
** ** ******* * * OF YOUR CODE*/
****** * **** * ***** function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
**** ** *** *** ** G[100];
* * * * * n;

* * * ** ***** * * YOUR CODE HERE*/
* **** ** ** * ** i;
*** ** * * **** * *** * ********* ** ** *
* * * * * * **** * * (i=0;i<n;i++){
** ***** * * * * * ** * * * **** * * * *** * ** *** * * ** * ***
** *** ** * ** * ** * ** **** * * * ** *** ** * * ** ***
** * * *** **** *** * *
******* * ** * **** * OF YOUR CODE*/

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

** * * * * ** * * * 0;
}
answered by (-249 points)
edited by
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong 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 <stdio.h>
float compute_GPA(char grades[],int n)
{
* ** * * *** ** * YOUR CODE HERE*/
** ** *** * * ****** c;
**** ** **** * **** sum=0;
* ** ** * *** ** ** * ** * * *** {
** * ** **** * * ** ** ** * ***** * ** * ******* * ** ** *** {
*** ** ***** * * **** ***** ** * * ** * * * *** ** **** *** * **
** **** ** ** * * * *** ** ***** * *** **
** ** ** * **** * ** *** **** ** *** ** ** * *** * if(grades[c]=='B'||grades[c]=='b') {
**** * * ** **** ** * ******* * ** ** * ** *** *** * ** ***** ** * * *
* ****** **** ** *** * * * * * * *** ** *
* *** ** ** ** ** * ** *** **** ** *** * ***** ** * * if(grades[c]=='C'||grades[c]=='c') {
* ** * ** * * * * * * * ** **** ** * *** * * * * * *** ** * ** * ** *
* ** ** *** * * **** ** ** * **** * * **** ** *
**** *** ****** *** ** *** * * ** * * *** * * * * if(grades[c]=='D'||grades[c]=='d') {
* * *** ** *** *** * * * *** * ** ** * *** * * * ****** * *
* * **** * * **** **** * ** ** **** * *
* **** * * * * * ** * * ***** * ****** *** if(grades[c]=='F'||grades[c]=='f') {
** ** ** * ** * * * * * *** * ** *** ** * *** ****** * ** * *** *** *** *
* ** ** * **** * * * ** *** **
*** ** * **** * * *

******* * ** * *** ** **
* **** * *** *** * **** * sum;
**** * * * ** OF YOUR CODE*/
* *** ** ** * * function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

*** * * **** ** **** YOUR CODE HERE*/
** *** * * * * ** * * **** ** &n);
* ** *** * ** ** ** c;
* ** **** **** * * * *** * *** {
* * * *** ******* * ** ** * **** * ** * * * *** *** &G[c]);
* * * ****** *** ** ** *
** * * *** * * * OF YOUR CODE*/

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

** * * ******* ****** ** 0;
}
answered by (-120 points)
edited by
0 0
Case 0: Wrong output
Case 1: Correct 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: Wrong 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 <stdio.h>
float compute_GPA(char grades[],int n)
{
* *** * ** * ** * * ** * YOUR CODE HERE*/
**** ********** * *** * * sum;
*** *** **** *** ** *** * i;
* ** * ** ** *** * * *** *** *** * *
* * *** ***** ** *** * ** ** * *** * ** ** * **** * ** * * *
*** * * * * * ** * * **** ** ** * * *** ** * ***
* * * * *** ** *** ** ** * * ** 'A':
* ****** ** **** * * *** ** *** * **** * * * * * ** ****** **** *
* * * * * * ** * ** *** ** ** * *** ** ** *** * * * ** *
* * ** * * * * * * * **** ** ***** * *** * ** 'B':
*** ** ** ** *** * ** ** ** * * *** * * ******* ** * * * * *** *
* * ** * * * *** * ** ***** * ** *** ** * * *** * * *
*** **** *** * ** ** * ** ** * * 'C':
* * *** ** ***** ** ** ** ** * ** * * * ******* * * *** ** *** *** * * * *
* ** ** * * ** * * * * * ** * * **** ** *** * * * **** ***** *
*** * *** * ** * **** * ** *** * **** **** ** * 'D':
* *** ******* ** **** * * ** * * *** * * *** * * *** * *** ** ** * * *
* ** * ** * * * *** ****** * ** * **** ** * * ***** *** *** * ** * * * *
** *** * **** * ** ** * * ** * *** ****
*** *** *** ** * **** *** ** * *** ** ** *** * ****** * * * ** * ***** ***
** * ** ***** ** * * ** *** **** *
* * * *** * ** * *** *
**** ** * * ** **** * ** sum/n;


* * * * * ***** * OF YOUR CODE*/
** *** *** ***** * function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
* *** * ***** * * G[100];
   int n;

*** ***** * * **** * YOUR CODE HERE*/
   int c;
   char nothing;
* **** * ****** ****** \'\n\'", &n);
   for ( c = 0 ; c < n ; c++ ){

** **** ** * * * **** ****** *** *** ***** * ***** &G[c]);
* **** * * ** ** *** * ** * * scanf("%c ", &G[c]);
   }
******* * * * * OF YOUR CODE*/

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

* * * * * ** * 0;
}
answered by (-116 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
float compute_GPA(char grades[],int n)
{
* *** ** * **** YOUR CODE HERE*/
* *** * * * ** *** *** sum;
* * ** ** ** * ** i;
***** * *** ** *** ** ** ** **** **
* * ** ** ** ** * *** **** * *** ** *** * *
** * * ** *** ** ** * * * *** ** ** ** * 'A':
*** ********* * *** ** * * ** ** * ** ** ** * *** ***** ***** **
******** *** * *** * * ** *** * ** * ** ** * * * * * * ** *
** ****** * **** * ** *** * ***** *** ** ** **** 'B':
* * * * * **** *** ***** ** * ** ** **** * *** * ******* **** *
* * ** * *** * * * * * ***** * **** ** ** * * ** * ****
** * *** * * * *** ** ***** **** * ** * * 'C':
* * * ******* *** **** * **** ** ******** ** * * *** * **** ** ** *
* * * *** * * * * *** ** ** * * * *** * * * ** * *** * ** ***
* * ** ** * ** **** * ** *** *** ** * 'D':
* * * * ***** * *** * ** * * **** ** * ** * ** ***** ** * ** * * * **
** * ** ** ** ** * * *** * * * * **** * *** * * ** ** * ******
* ** * ** ***** * *** **** * * * * * * *** * ****
* ****** * * ***** *** * **** * ** * * ** * ** * * * ** ** ** *** **
*** * * * **** *** *** ** * ** *** *
****** * ** * **
* * ** ** * *** sum/n;


* ** * * * ** * * *** OF YOUR CODE*/
   //The function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

* ** * * ******** * * * YOUR CODE HERE*/
   int c=0;
* ** *** * * *** ** * * ** ** ** * &n);
* * * * * * *** * //take \n
   char temp;
   for (;;){
*** * ** * *** * * **** *** * * ** * * * ** *** * * *** ** *
*** * * * ** ******* ** ** * **** >= 'A'){
* * * **** **** ** * ***** ** * * **** **** **** *
** *** ** **** * ****** ***** ** * ** ***** ** **** **
****** ** * **** **** ***** * * *
* ** * **** * *** *** ** ** * if(temp == '\n') break;
   }
   /*END OF YOUR CODE*/

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

**** * * ** * ** ** * 0;
}
answered by (-116 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>
float compute_GPA(char grades[],int n)
{
* ***** * ** * ** YOUR CODE HERE*/
***** *** **** * * * sum;
** * *** * * * ** * **** i;
****** ** * ***** ** * ***
* ** * ** * ** ** * *** * * * ** ** ** * * * * ** *
* ** * ** ****** **** * * ********** * * * ** * ** * 'A':
* **** *** * * * * ** ** * **** *** * ** * * ** * ***** ****** **** *
****** * * **** * * * * **** * *** ** * * ** * * * **** *
* ** ** ** ** * ** * ** ****** * * * * 'B':
*** * ** ** * * *** * *** * * ** * * * **** * * ****** **** * **
* ** * ** **** **** * ** ** ** ** * * ** ** *** ******* ** ** ** * * *
** ****** ** ** * * *** *** * ** * * ** ** * * * 'C':
* ** ** **** ** * ****** *** * *** ** * * * * *** ****** ** * ** ***
* * * *** ** ** * * * ****** * * * * * * *** *** ** * *** *** ** **
* ** * * * * * * **** * **** * ** 'D':
* ** * * * ***** * * * ** *** ****** **** ** *** *** **** ** * ***
* ** * * * *** * * ***** ** * * ** **** ** * ** * ****** * *
* * * * *** * *** * * * * **** * *** ***** * * *
* * * ** ** ** ** ** ***** **** ***** * *** * * ** * **
* ** **** * ** * *** ** * * ** *** *** ** *** *
** ** ** * * ** **
* ** ** *** **** *** * ** sum/n;


   /*END OF YOUR CODE*/
** *** * ******** function should return the average of the grades(assume that A=4,B=3,C=2,D=1, and F=0).
}

int main(void)
{
   char G[100];
   int n;

***** ***** * *** * YOUR CODE HERE*/
   int c;
*** ** ** ** *** * *** ******* &n);
   for ( c = 0 ; c < n ; c++ ){
** * ** * *** * * * * * * *** ** * ** * * &G[c]);
* ** * * * ** ** *** * ** *** *** ** **** * ** ** ' ' '\n'
   }
* * * * * * * ** OF YOUR CODE*/

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

* *** * * ** **** * * 0;
}
answered by (-116 points)
0 0
prog.c: In function 'main':
prog.c:42:15: warning: format '%c' expects a matching 'char *' argument [-Wformat=]
       scanf("%c");//take ' ' '\n'
               ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <ctype.h>
#include <string.h>
float compute_GPA(char grades[],int n)
{
   int i;
** * ** ** * *** ** sum = 0;
* * * ******** ** ** **** i < n; i++)
   {
* * * ** ** * *** * * ***** * ** *
** * *** *** **** * * * * * ****
* * * *** **** * *** ** * ** ** ** *** * * *** **** * * * ** * 'A': case 'a':
* * * **** *** *** **** **** ** * * ** **** ** ** * *** *** ** * * **** * += 4;
*** * * * ** *** * **** *** * ** * ** * ** ** **** ** * * ** * * ** ** ** *******
**** ** * ** ** * ** * ***** **** *** * **** ** * ***** * * * * ** 'B': case 'b':
*** * ** * * *** * ** * * ** ** ** * * *** ** ** * ** ** * ** * * * * * *** * * * ****** += 3;
****** * * * * ** * * * **** ** * ***** * * **** * * * ** * * *** ** * *** **** ** ****
** * ***** * **** * ***** * * * *** * * ** * * **** * * ** * * ** 'C': case 'c':
* ** * ** *** * * * *** * * ** **** * ***** ** ** * * * ** *** ** * ** * += 2;
* * ******* * * *** **** ** ** ** * ** ** * * **** * * ** * * * **** ** ** * * * * * *** *
*** * * ** * ** *** *** * ** **** * * ***** * ** * * **** * 'D': case 'd':
* * **** ** * *** * * * * * * ** * * ** ** ** * * * * **** ** *** * * ** * * += 1;
** **** ****** ***** *** **** *** * * ** **** *** ******* * *** * * ** **** * *
** * * ******* **** * * **** * ** ** * * ** * * * *** * * * * ** * * * 'F': case 'f':
***** *** ** ***** * ** * * **** ***** * ** * ****** ** * * ** * ** * **** * * * * *** += 0;
** ***** * ** ** ** * * * ** **** *** ** * *** ** * **** ** ** * **** * * *** **
* ** * *** ** * * * * ** ** **
   }

*** * *** * *** sum/n;
}

int main(void)
{
   char G[100];
   int c, n;

*** ** **** * * * ***** ** ** **** &n); //Enter number of elements in array
*** ** *** * *** ** * = 0; c < n; c++)
   {
** *** ***** ******* ** *** * *** ***** * * * **** %c", &G[c]);
   }

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

* ** ** * * *** *** ** 0;
}
answered by (5.2k 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.71.254.103
©2016-2025

Related questions

0 like 0 dislike
38 answers
[Exercise] Coding (C) - asked Dec 13, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 37277 - Available when: 2017-12-14 18:00 - Due to: Unlimited
| 4.7k views
0 like 0 dislike
41 answers
[Exercise] Coding (C) - asked Dec 14, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 37370 - Available when: 2017-12-14 18:00 - Due to: Unlimited
| 4.9k views
0 like 0 dislike
45 answers
[Exercise] Coding (C) - asked Dec 7, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 35784 - Available when: 2017-12-07 18:00 - Due to: Unlimited
| 5.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users