Code:
#include <stdio.h>
#include <stdlib.h>
/*Ask user test scores, calc how many pass (70%+), and percentage of passing scores/not passing scores
70 - 100 passing, 0-69 failing, any other values invalid, -1 to quit*/
main() {
int score, passing, failing = 0, count = 0;
double percentPass;
/* printf("Enter in the test scores (-1 to quit)");
scanf("%d", &score); */
while (score != -1){
printf("Enter in the test scores (-1 to quit)");
scanf("%d", &score);
if (score <= 100 && score >=70 ) {
count++ ;
}
else {
if (score < 70 && score > 1) {
failing++ ;
}else if (score == -1){
printf("\n****************************************************\n");
}
else {
printf("You entered an invalid test score\n");
}
}
}
printf("There were %d passing scores and %d failing scores \n", count , failing);
printf("****************************************************\n \n");
}
This will work fine