write a program that determines a student\'s grade. It readsthree test scores (b
ID: 3611112 • Letter: W
Question
write a program that determines a student's grade. It readsthree test scores (between 0 and 100) and calls a function thatcalculates and returns a student's grade based on the followingrules: 1. If the avg. score is 90% or more,the grade is A. 2. If the avg. score is 70% or moreand less than 90%, it checks the third score. If the third scoreis more than90%, the grade is A; otherwise, the grade is B. 3. If the avg. score is 50% ormore and less than 70%, it checks the avg. of the second andthird scores. Ifthe avg. of the two is greater than 70%, the grade is C; otherwise,it is D. 4. If the avg. score is less than 50percent, then the grade is F. write a program that determines a student's grade. It readsthree test scores (between 0 and 100) and calls a function thatcalculates and returns a student's grade based on the followingrules: 1. If the avg. score is 90% or more,the grade is A. 2. If the avg. score is 70% or moreand less than 90%, it checks the third score. If the third scoreis more than90%, the grade is A; otherwise, the grade is B. 3. If the avg. score is 50% ormore and less than 70%, it checks the avg. of the second andthird scores. Ifthe avg. of the two is greater than 70%, the grade is C; otherwise,it is D. 4. If the avg. score is less than 50percent, then the grade is F.Explanation / Answer
There are several ways to do this problem however this shouldwork. #include #include double averageGrade(int grade1, int grade2, int grade3); int main(void){ int grade1 = 0; int grade2 = 0; int grade3 = 0; double average; printf("First Grade Please "); scanf("%d",&grade1); printf("Second Grade Please "); scanf("%d",&grade2); printf("Third Grade Please "); scanf("%d",&grade3); average =averageGrade(grade1,grade2,grade3); //printf("%f ",average); if(average > 89) printf("Grade is A "); else if(average > 69 && average 89) printf("Grade is A "); else printf("Grade is B "); } else if(average > 49 && average 69) printf("Grade is C "); else printf("Grade is D "); } else if(average < 50) printf("Grade is F "); system("PAUSE"); return 0; } double averageGrade(int grade1, int grade2, int grade3){ int sum = grade1 + grade2 +grade3; returnsum/3; }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.