3 like 0 dislike
13.3k 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 | 13.3k views

86 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>



int main(void)

{
* * **** ** ** ** *** a,b,c,x,y;
** ** *** *** * * * * * * ** * * * ** * **** *** *****
** * ** ** *** * ** * * * = a + b;
*** * *** ****** *
*** * **** ** *** *** * * *
** * ** ** ** * * * * Ratio: * * **** ***
*** * * * * * * **** Ratio: * * * * * *******


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

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



int main(void)

{
*** **** * **** * ** * a,b,c,x,y;
*** * **** * * * * * * * *** * * ** ** * * * * ** *
**** ***** ** * = a + b;
* ***** * * * ** ** **
******* * ** **** * ** *
** * * ** ** * ** * ** *** ** * Ratio:%d%%\n",x);
****** * **** * * * * *** * *** * * ** **


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

}
answered by (42 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void)
{
* ** * ** ** ** * * * a,b;
* * * ** * * ** * *** ** c;


*** *** ** *** * ** ** * *** * * * **
* *** ** * *** * **** * ****** *
*** * ** ** * * * ** * *
***** ** * * **** ** ** * * Ratio: * *** * ****
* ** * * * *** ** * **** * *** ** * Ratio: %d%%",(b*100)/c);
** ***** * * *** * * * * 0;
}
answered by (-168 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main ()
{
* *** * ** * * * a,b,c;

** ** ***** *** *** *** * ****** *** *
** *** ***** * * ** * ** *** * * *
** * *** ***** **** * *
* **** * ***** *** * * * ** * * * ** Ratio: * * * ******* **
** *** ** * ** ***** * ** ** * Ratio: %d%%",(b*100)/c);
* ** **** *** * * * **** * 0;
}
answered by (-140 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
** * * *** ****
int ***
{
int a,b;
float c,d;
*** * ***** ***
* * *** ** *** * *
c= * ******
* * **** * *
** * * ** * * * *** *
** * * * ** Ratio: **** * **


*** 0;
}
answered by (-329 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;
**** * *** * ** ******* c;




** ** *** * * **** * ** * ***** * * * **
*** * * * * ** ** ***** * *** * ***
***** ** *** **** ** * *** *
* * **** ** * ** ** * *** * * ** * * ratio: * * * * ** **
* * ** ** ****** * * ** *** ratio: %d%%",(b*100)/c);
*** *** * * * * ** ******* 0;

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

int **

{

int a,b;

float c,d;
* ***** *** * * * *** * ** **
*** * * ** *** ** *

c= *** * *
****** *
*** * ** * **** * ** ** * ** *
* * * * * *** ** * * * *





return 0;

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

int main(void)

{
* *** * * ** *** * a,b;
* ***** * * **** * c;




* * *** *** * ** ** * * **** ** * ***** *
** * ** ** * * * * *** ** * * * ** * *
* **** * ***** *****
** ** * * * ** * ******** * * ratio: ** ** * *
** * **** *** * *** ** **** * ** ** **** ratio: %g%%",(b*100)/c);
*** * *** ***** ** * * 0;

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

int main(void)

{
* ** * ** *** *** * * ** ***** a,b;
******** * ** *** *** * * c;




* * * ** ** *** * *** * ** * *** * *
* * * ** * ** * * * * ** *** ** ** *** *
* * ** * * *** ***** * * *
***** *** ** * * ** * ** * * ratio: *** **** * * **
** * * * * * **** ** * *** ratio: %g%%",(b*100)/c);
**** ** * * * *** * * 0;

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


int main(void)

{


float *** * * * * ** *** * ** ** * ** *

*** * *** ** * * * * ** *** *
scanf ** ** * * ** **** **** ** *

float sum = * **** * ** ****

* * ** ** = * * ** ***
* * * * * *** * ** *** * ***

**** *** **** Ratio: * *** * *** *** *
* * * ** Ratio: * * ** ** *


return 0;
}
answered by (-107 points)
0 0
prog.c: In function 'main':
prog.c:11:9: error: format '%d' expects argument of type 'int *', but argument 2 has type 'float *' [-Werror=format=]
 scanf("%d",&number_passes);
         ^
prog.c:12:10: error: format '%d' expects argument of type 'int *', but argument 2 has type 'float *' [-Werror=format=]
 scanf ("%d",&number_failures);
          ^
cc1: all warnings being treated as errors
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.245
©2016-2025

No related questions found

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