ADD file via upload

main
pfjlev589 1 year ago
parent bd45168bfd
commit 01515ac351

@ -0,0 +1,42 @@
#include <stdio.h>
typedef struct {
char id[6];
double math;
double physics;
double english;
double total;
} Student;
void inputStudentInfo(Student *student) {
scanf("%s", student->id);
scanf("%lf", &student->math);
scanf("%lf", &student->physics);
scanf("%lf", &student->english);
student->total = student->math + student->physics + student->english;
}
void displayStudentInfo(Student student) {
printf("%s %.1lf %.1lf %.1lf %.1lf\n",
student.id,
student.math, student.physics, student.english, student.total);
}
int main() {
Student students[3];
int i=0;
while(i<3)
{
inputStudentInfo(&students[i]);
i++;
}
printf("\n");
for (int i = 0; i < 3; i++) {
displayStudentInfo(students[i]);
}
return 0;
}
Loading…
Cancel
Save