3 like 0 dislike
5.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 | 5.6k views

86 Answers

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

int main()
{
**** * ** * * ** * * * ** * x,y;
***** * ********* * ** * ***** a=0,b=0;
**** * *** ****** * * * *** ** ** * ** **** ***
* ***** ** * * * * ********
* *** ** ***** * * * ****
* ****** *** ** * * * ***** * ** * * Ratio: %g%%",a);
* ** ********* ** ** * * * * * ****
**** ***** ** * * ***** ** *** ** Ratio: %g%%",b);

}
answered by (54 points)
0 0
prog.c: In function 'main':
prog.c:11:14: error: unknown conversion type character 0xa in format [-Werror=format=]
     printf("%\n");
              ^
cc1: all warnings being treated as errors
0 like 0 dislike
Hidden content!
#include * * * * **

int main (void)

{
* * * * *** *** * a,b;
* ****** * * * *** * ***** ** * * * **** **** * ** *
** * * *** ** * *** * ** ** Ratio: %g%%\nFail Ratio: ******** * ** * * * * *

*** * *** ** ** ** ***** 0;
}
answered by (-204 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
* ** * ** * ***

int main() {
** ** ** ********** * ***** a,b;
* * * * * * ** ** ** c;
*** * ** *** * * ** *** %d", &a, &b);
* * * **** ** *** * ** *
**** * * * * ** * ** * p,f;
* * * * * * ***** *** **
****** ** **** **** * * ***
**** * ****** **** * ** * p2,f2;
* *** * *** ******* * *
* ** * ** *** * ** ** ** * *
* ** ** ** * * * * *********** Ratio: %d%%\n", p2);
** * * *** **** ** ** * * * ** Ratio: %d%%", f2);
}
answered by (-120 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
* * ** * ** **



int main() {
*** *** * * ** *** * a,b;
** * **** * * ** * ** * * c;
* ** *** * * * ** ** ** ** %d", &a, &b);
** * * *** *** * *
* *** * ** ** * * * * p,f;
* ** * * * ** ** ** *
* ** * * ***** * ** *** ***
*** * ** * **** **** * *** ** p2,f2;
* * * *** * ****** *** **
*** ** **** ** ******* * **
*** * *** * * * *** * ** ** * * * * *** * Ratio: %d%%\n", p2);
* *** * ** * * **** *** ** ** Ratio; %d%%", f2);

}
answered by (-120 points)
0 like 0 dislike
Hidden content!
** *** ******



int main() {
* * * * ** * * a,b,c;
*** * **** ** * ******** **** * * %d", &a, &b);
* **** * * * * ** * * *
**** ** * ** ****** *** * p,f;
***** *** ** ***** * * **
* ** **** *** **** **** ***
** ******* ** * * ***** p2,f2;
* *** ** * *** * * * ** * * *
** * * *** *** ** **** * *
** * * * *** * *** *** * ** ***** **** * Ratio: %d%%\n", p2);
**** * ** *** * * * ** * *** ** Ratio; %d%%", f2);

}
answered by (-120 points)
0 like 0 dislike
Hidden content!
#include ** *

int main(void)
{
** * ***** * *** ** a,b,sum1,sum2;
******* ****** * * ***** ** ** * ******* *** **** ***** * * *
** ** ** ** * ** = a*100/(a+b);
* ** * ***** ** ** *** *** = b*100/(a+b);
* ** * * * ****** *** ** ** ** *** Ratio: * ** * *****
* *** ** * *** ** ** * ** * ** *** *** Ratio: ** ** ** ****

* * * ** ** ****** ** 0;

}
answered by (-323 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>



int main(void)

{
* * * * ** ** ** * ** a,b,sum1,sum2;
* ** ** ***** ** * ** * * ** * * * * *
* * * * *** * ** * ** ** * * = a*5;
*** ** * **** * ******** * = b*5;
* *** * * * * * ** ** (sum1>40)
* * **** ** * * *** * ** ** * *** * ****** ** * * * ** * Ratio: %d%%\n",sum1);
* ****** * ** * * ****
******* ** * **** *** * * * * *** ***** * ** * * *** Ratio: %d%%",sum1);
* ***** *** **** * * * * * * *
* *** * ** ** * * * ** * **** * * * * * * ** *** ** * ** * Ratio: * * ** **
***** ** *** * *** * * ** ** *
* * ** ** ** *** *** *** * * *** * ** **** ****** * * ** Ratio: %d%%",sum2);
* ** * * * * * ** ** * 0;



}
answered by (-323 points)
0 like 0 dislike
Hidden content!
* * ***** * * *** *
int main(void)
{
* * * ***** * ***** * a, b,success, fail ;
***** ** ** ** ** * ** * * **** * *** * **
**** ** ** ** ** ** *** * ** ** *
* * ** * ***** * * * * * ** * * *** ****
*** * * * * * *** ** * Ratio: %g%%\nFail Ratio: * ** **** success, fail);
** * * *** *** * ** 0;
}
answered by (-304 points)
0 0
prog.c: In function 'main':
prog.c:5:13: error: format '%d' expects argument of type 'int *', but argument 2 has type 'float *' [-Werror=format=]
     scanf("%d%d", &a, &b);
             ^
prog.c:5:15: error: format '%d' expects argument of type 'int *', but argument 3 has type 'float *' [-Werror=format=]
     scanf("%d%d", &a, &b);
               ^
cc1: all warnings being treated as errors
0 like 0 dislike
Hidden content!
** ** * * * ** * * *



int main() {
** ** ** * * ** * a,b,c;
**** ***** * * * * * %d", &a, &b);
* *** ** * * * *** **** **
** * * * * ** * * *** * p,f;
** * * * * **** ** * * *** *
* * * * ** * **** **
* ** * * ** *** * * ** p2,f2;
* * ** * ** *** *** ** * *****
** * ** ** ****** * * *****
* * *** * ******* * *** * ** * ** * *** Ratio: %d%%\n", p2);
* * * **** *** * ** *** * * * * Ratio; %d%%", f2);



}
answered by (-120 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



int main(void)

{
** * *** * ** * ** * ** a,b,sum1,sum2;
**** ** ** ***** **** ** * ***** * * **** ***
** ********* * ***** * * = a*5;
* * *** ** **** * * = b*5;
* * * * * * *** ** ** (sum1>40)
* **** ** * *** * * ****** ** ** * ** ** * *** Ratio: %d%%\n",sum1);
* * ** ** * ** * * * * *
* * * * ** ** ** * ** ********* *** * *** ** **** * Ratio: %d%%",sum1);
* * * ** ****** * * *** * **** *** *
* * * ** ** ** * ** *** * * * ** *** ** * **** * ** Ratio: *** * **
* * * ** * * **
** * ****** ** *** * ** **** * ** ** * ** *** * * Ratio: %d%%",sum2);
*** *** * ** * ** * * * ** 0;



}
answered by (-323 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.100
©2016-2024

No related questions found

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