I ended up fixing the errors:
Code:
#include <stdio.h>
int main ()
{
int hw1, hw2, hw3, hwtotal;
int proj1, proj2, proj3, proj4, projtotal;
int exam1, exam2, exam3, examtotal;
float grade;
/* Get user input scores */
printf("Enter the homework 1 score: \n");
scanf("%d", &hw1);
printf("Enter the homework 2 score: \n");
scanf("%d", &hw2);
printf("Enter the homework 3 score: \n");
scanf("%d", &hw3);
printf("Enter the project 1 score: \n");
scanf("%d", &proj1);
printf("Enter the project 2 score: \n");
scanf("%d", &proj2);
printf("Enter the project 3 score: \n");
scanf("%d", &proj3);
printf("Enter the project 4 score: \n");
scanf("%d", &proj4);
printf("Enter the exam 1 score: \n");
scanf("%d", &exam1);
printf("Enter the exam 2 score: \n");
scanf("%d", &exam2);
printf("Enter the exam 3 score: \n");
scanf("%d", &exam3);
/* Calculate the grades */
hwtotal=hw1+hw2+hw3;
projtotal=proj1+proj2+proj3+proj4;
examtotal=exam1+exam2+exam3;
grade=(hwtotal/300)*.12+(projtotal/400)*.28+(examtotal/300)*.6*100;
/* Shows the user their grade */
if (grade<=60)
{
printf("With an average of %f, your course grade is an F.\n", grade);
}
else if (grade<70)
{
printf("With an average of %f, your course grade is a D.\n", grade);
}
else if (grade<80)
{
printf("With an average of %f, your course grade is a C.\n", grade);
}
else if (grade<90)
{
printf("With an average of %f, your course grade is a B.\n", grade);
}
else if (grade>=90)
{
printf("With an average of %f, your course grade is an A.\n", grade);
}
return 0;
}
But when I execute the program no matter what grades I enter, it always comes out 0.00000 and F. Why is this? What can I do to fix that?