-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram6
More file actions
32 lines (26 loc) · 783 Bytes
/
Copy pathProgram6
File metadata and controls
32 lines (26 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
int main() {
float s1, s2, s3, total, avg;
printf("Enter marks of three subjects:\n");
scanf("%f %f %f", &s1, &s2, &s3);
if (s1 < 35 || s2 < 35 || s3 < 35) {
printf("Student failed due to marks < 35 in one or more subjects.\n");
} else {
total = s1 + s2 + s3;
avg = total / 3;
printf("Total = %f\n", total);
printf("Average = %f\n", avg);
if (avg >= 70) {
printf("Grade: Distinction\n");
} else if (avg >= 60) {
printf("Grade: First\n");
} else if (avg >= 50) {
printf("Grade: Second\n");
} else if (avg >= 35) {
printf("Grade: Third\n");
} else {
printf("Fail\n");
}
}
return 0;
}