fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int x,count2=0 ,count1=0;
  6. for(int i=1;i<=10;i++){
  7. printf("Enter result:\n ");
  8. scanf("%d",&x);
  9. if (x<60){
  10. count2++;
  11. }
  12. else{
  13. count1++;
  14. }
  15. printf("There are %d pass,and %d fail.\n",count1,count2);
  16. }
  17. if (count1>=8)
  18. printf("Bonus to instructor!");
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5420KB
stdin
70
80
90
99
0
50
40
30
20
10
stdout
Enter result:
 There are 1 pass,and 0 fail.
Enter result:
 There are 2 pass,and 0 fail.
Enter result:
 There are 3 pass,and 0 fail.
Enter result:
 There are 4 pass,and 0 fail.
Enter result:
 There are 4 pass,and 1 fail.
Enter result:
 There are 4 pass,and 2 fail.
Enter result:
 There are 4 pass,and 3 fail.
Enter result:
 There are 4 pass,and 4 fail.
Enter result:
 There are 4 pass,and 5 fail.
Enter result:
 There are 4 pass,and 6 fail.