3 like 0 dislike
2.6k views

Write a program that reads the number of students who passed and failed in the exams and displays the percentages. For example:

輸入及格與不及格人數
輸出及格與不及格百分數

Example input:

12 8

Example output:

Success Ratio: 60%
Fail Ratio: 40%
[Exercise] Coding (C) - asked in Chapter 4: Expressions by (12.1k points)
ID: 25730 - Available when: Unlimited - Due to: Unlimited

edited by | 2.6k views

86 Answers

0 like 0 dislike
Hidden content!
** * ** ** * * *
int main()
{
** * *** **** ** * * *** a,b,c,d;
** ******* * * ** * ** ** * * * ** * *******
* *** *** * * * * * * * * * *** * Ratio: ** * *** **
** * * * **** * * * ** * ** Ratio: %g%%",100*(b/(a+b)));
* * * * * ** * * ** *** * ***** 0;
}
answered by (-329 points)
0 0
prog.c: In function 'main':
prog.c:5:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'float *' [-Wformat=]
     scanf("%d%d",&a,&b);
             ^
prog.c:5:15: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'float *' [-Wformat=]
     scanf("%d%d",&a,&b);
               ^
0 like 0 dislike
Hidden content!
#include ** ** ** * **
int main()
{
**** ** ** * ** ** * ** *** a, b, ans, sr, fr;

* ** ** * * * *** * *** * * ** * &a, &b);

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

* * * *** * *** * * ***** * ** ** Ratio: ** ****** * sr);
***** ** ** * *** ** * ** ****** *** Ratio: **** * fr);
***** * ** * ** ** * 0;
}
answered by (-168 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include *** ** * *
int main()
{
**** * ** * ** * ***** * a, b, ans, sr, fr;

**** * * ****** *** * * *** * *** * &a, &b);

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

* ***** * *** ** *** *** ** *** Ratio: * ** ** sr);
** * ** * * *** ** ** ****** * * * Ratio: * *** fr);
***** * * * *** * * * * 0;
}
answered by (-168 points)
0 0
prog.c: In function 'main':
prog.c:6:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'float *' [-Wformat=]
     scanf("%d %d", &a, &b);
             ^
prog.c:6:16: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'float *' [-Wformat=]
     scanf("%d %d", &a, &b);
                ^
0 like 0 dislike
Hidden content!
* ** * * * ** **
int *

{

int a,b;
** c;
* **

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

** * * *** * *** ** * *** * **
*
*** * 100;
** - good;

*** ** ** ** * ** c)
*** ** ** * * ** * d)*/

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


}
answered by (-249 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include **** ****
int main ()
{

* **** * **** * * ***** * ** pass, fail;
* ** ******** * * * ** *** *
*** * * ** ****** * * * * ** **** &pass, ** *

* *** *** * *** * ** = ***** ;
* * * **** * * * ** = **** ** *
* * ** ** *** *** * ** * * * ** * * Ratio: * * *** * * passratio);

* ****** ** ** *** * * Ratio: * * * **** failratio);

* * * * * **** 0;




}
answered by (-167 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * ** ** ** *
int main ()
{

* * *** * ** * * *** * * pass, fail;
* **** * * * * * **** ** *
* ** * * * **** * *** * * * ** * * &pass, ** *

* ** * *** * * **** = ** ** ;
*** * *** ** ** * *** ** * * = ** *** ***
** * *** ** ** *** ** Ratio: ** * * ** passratio);

* * ** * ** * ****** **** * Ratio: ** * ** * failratio);

** ** **** * 0;




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

int main() {
**** * ** ** ***** ** *** *
* * **** ** * ** ** ** n1,n2;
* * * ** * *** ** tot=0;
** * * * * *** *** ** pass,fail;
** *** * ** * * *
* * * * ** ** * * * ** ** ** **** **** &n1, &n2);
* ** * * * *** *** *** *
* * ** * * * ** * * * ** = n1+n2;
* * *** ** **** * *** = ((n1*100)/tot);
*** * ** * * ** * **
*** * ** * ** * * ** ** * * = ((n2*100)/tot);
* * ** ***** ** ** * ***
* * * *** ** ** * * *** Ratio: * ** * pass);
** * * * * * * **** **** ****** *** *** Ratio: %d%%", fail);
**** *** * * *** * ** *
** * * * * ** ** **
* * * ** * * * *** ** 0;
}
answered by (323 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include **** **** * **

int main() {
** *** * *** * * ****
***** *** * *** * *** * n1,n2;
* *** ****** **** ***** ** ** tot=0;
* ** ** * * ** pass,fail;
* ******* *****
* * * * ** * **** * ** **** * ** * &n1, &n2);
* * ** * *** * **
** * ** ** ******** ** = n1+n2;
* * * * ***** ****** * = ((n1*100)/tot);
*** * **** ** *** ** *
* * * * *** * ** **** * = ((n2*100)/tot);
* * ** * ****** * * **
* * ** ** * * * * ** ** * * Ratio: ** ** *** pass);
* * * * **** * * ** * ** ** ** ** * ** Ratio: %d%%", fail);
* * * *** * *** * **
*** *** ** ***** * * ***
* ** ******** ** *** **** 0;
}
answered by (323 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()
{
* * ** * ** * ** ** * pass;
*** * * * * * * fail;
*** ****** * ******* ** ** sum;
* * * * * * * * * ** avg1;
* * * ** ** * ** ** ** avg2;
* ** * ** **** *
* * * * ** ** * *
* *** * ** ** * * *****
* ** ** * **** ** ** **** * * * %d",&pass, &fail);
********** ** * **** **
** * **** * *** * *** *** *** ***
* ** *** * * * ** ** ** * *
* ***** ** *** **** ** * * *** * **
*** * * * ***** * *
** * * ** *** ** * * * ** * * ** * ** ** Ratio: %d%%\n",avg1);
* *** ** ** **** * * ** * * Ratio: %d%%",avg2);
****** * **** * *
* ** ** *** * * ** * * * *** 0;
}
answered by (-193 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
****** * * * ***

** **

{

int a,b;

* * * ** * *** ** ** ** *
* * *** * * * %d %% * *** * ** * **
*** *** ** * ** %d %% * ** ** * *
* 0;

}
answered by (-66 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.18
©2016-2024

No related questions found

12,783 questions
183,443 answers
172,219 comments
4,824 users