Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- double pass = 0;
- double fail = 0;
- double counter = 0;
- int result = 0;
- double rate = 0;
- while (result != -1){
- printf("Enter result(1=pass,2=fail,-1=end)");
- scanf("%d",&result);
- if(result==1){
- pass = pass + 1;
- }
- else{
- fail = fail + 1;
- }
- counter = counter + 1;
- }
- rate = pass/counter;
- printf("通過人數: %d,未通過人數: %d", pass, fail);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement