The syntax of if is as below (with the else [statement] being optional)
if ([condition])
[statement]
else
[statement]
Now using this, your could should look like this:
#include <stdio.h>
int main()
{
float uts, uas, assignment, attendance;
printf("Enter student grades\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("Enter UTS grades: ");
scanf("%f", &uts);
printf("Enter UAS grades: ");
scanf("%f", &uas);
printf("Enter assignment value: ");
scanf("%f", &assignment);
printf("Enter attendance: ");
scanf("%f", &attendance);
float score = (0.3f * uts) + (0.35f * uas) + (0.3f * assignment) + (0.05f * (attendance / 14));
if (score > 77.0f)
{
printf("YOUR LETTERS VALUES ARE: A\n");
}
else if (score > 70.0f)
{
printf("YOUR LETTERS VALUES ARE: AB\n");
}
else if (score > 63.0f)
{
printf("YOUR LETTERS VALUES ARE: B\n");
}
else if (score > 55.0f)
{
printf("YOUR LETTERS VALUES ARE: BC\n");
}
else if (score > 45.0f)
{
printf("YOUR LETTERS VALUES ARE: C\n");
}
else if (score > 25.0f)
{
printf("YOUR LETTERS VALUES ARE: D\n");
}
else
{
printf("YOUR LETTERS VALUES ARE: E\n");
}
return 0;
}
Notes:
- I applied a bit of formatting
- I added the f suffix after the number literals to distinguish a float from a double type.
- Your original code was wrong because it didn't handle score == 25 case. The above code handles that case correctly.
- printf(Enter UAS grades": "); line had the quotes in the wrong locations. I fixed it in the code.