151. 學生成績統計

 avatar
user_6817964
c_cpp
2 years ago
552 B
1
Indexable
Never
struct Student
{
    char studentName[20];
    int score;
};
typedef struct Student student;

int main() {
    student a, b, c;
    scanf("%s%d", &a.studentName, &a.score);
    scanf("%s%d", &b.studentName, &b.score);
    scanf("%s%d", &c.studentName, &c.score);
    int avg = (a.score + b.score + c.score) / 3;
    student max;
    max = a;

    if (b.score > max.score) {
        max = b;
    }
    if (c.score > max.score) {
        max = c;
    }

    printf("avg = %d\n", avg);
    printf("max = %s", max.studentName);
}