OK I need help figuring out why my code doesn't work like I want it to. I need it to calculate the weighted percentages of a student taking 4 quizzes, 2 midterms and a final exam. the final and quizzes are weighted 30% while the midterm is 40%. The problems I'm having are:
- The test/Midterm section of the code isn't accepting the fourth input; I would put 80 80 80 80, but the compiler wouldn't recognize the last input and calculate as is.
- The final exam portion only works if I put a zero after enter the two test/midterm inputs
I'm new to coding and any help would be appreciated (:
#include <stdio.h>
int main()
{
int testOne,testTwo,testPoint,totTest;
float percTest;
printf("Enter you test grades:\n");
scanf(" %d%d\n",&testOne,&testTwo);
totTest=testOne+testTwo;
printf("Your total grade points is: %d\n", totTest);
testPoint=200;
percTest=(totTest*.40)/testPoint *100;
printf("Your percentage is %.1f%%\n", percTest);
int quizOne,quizTwo,quizThree,quizFour,quizPoint,totQuiz;
float percQuiz;
printf("Enter you quiz grades:\n");
scanf(" %d%d%d%d\n",&quizOne,&quizTwo,&quizThree,&quizFour);
totQuiz=quizOne+quizTwo+quizThree+quizFour;
printf("Your total quiz grade is %d\n", totQuiz);
quizPoint=400;
percQuiz=(totQuiz*.30)/quizPoint *100;
printf("Your quiz percentage is %.1f%%\n", percQuiz);
int examOne,examPoint;
float percExam,finGrade;
printf("Enter your exam grade:\n");
scanf(" %d\n",&examOne);
printf("Your total exam points is: %d\n", examOne);
examPoint=100;
percExam=(examOne*.30)/examPoint *100;
printf("Your final exam grade is %.1f\n", percExam);
finGrade=(percExam+percQuiz+percTest);
printf("Your overall grade is %.1f%%\n", finGrade);
return 0;
}