ADD file via upload

main
pui26hfw7 1 year ago
parent 9ddbbc05ff
commit 7942b92ef4

@ -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