-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall.c
More file actions
43 lines (37 loc) · 821 Bytes
/
call.c
File metadata and controls
43 lines (37 loc) · 821 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
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
char grade (int score) {
if (score >= 80) {
return 'A';
} else if (score >= 70) {
return 'B';
} else if (score >= 60) {
return 'C';
} else if (score >= 50) {
return 'D';
} else {
return 'F';
}
}
void line () {
printf("==========================================\n");
}
title () {
line();
printf("Num\t\t Score\t\t Grade\n");
line();
}
int main () {
int score[5] ,i;
char grades[5];
for (i = 0; i < 5; i++) {
printf("Input Score [%d] : ", i + 1);
scanf("%d", &score[i]);
}
title();
for (i = 0; i < 5; i++) {
grades[i] = grade(score[i]);
printf("%d\t\t %d\t\t %c\n", i + 1, score[i], grades[i]);
line();
}
return 0;
}