-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab1.c
More file actions
53 lines (37 loc) · 1.34 KB
/
lab1.c
File metadata and controls
53 lines (37 loc) · 1.34 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
/* Function declarations */
float calculate_average(int score1, int score2, int score3, int score4, int score5);
const char* determine_classification(float average);
int check_award(float average);
int main() {
int score1, score2, score3, score4, score5;
float average;
const char* classification;
int award;
/* Get the scores from the user */
printf("Enter the score for Module 1: ");
scanf("%d", &score1);
printf("Enter the score for Module 2: ");
scanf("%d", &score2);
printf("Enter the score for Module 3: ");
scanf("%d", &score3);
printf("Enter the score for Module 4: ");
scanf("%d", &score4);
printf("Enter the score for Module 5: ");
scanf("%d", &score5);
/* Calculate the average score */
average = calculate_average(score1, score2, score3, score4, score5);
/* Determine the classification */
classification = determine_classification(average);
/* Check if the student qualifies for an award */
award = check_award(average);
/* Output the results */
printf("\nAverage Score: %.2f\n", average);
printf("Classification: %s\n", classification);
if (award == 1) {
printf("Congratulations! The student qualifies for an award.\n");
} else {
printf("The student does not qualify for an award.\n");
}
return 0;
}