You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.0 KiB
28 lines
1.0 KiB
#include <stdio.h>
|
|
int main()
|
|
{
|
|
float sum(float a,float b,float c);
|
|
struct Student
|
|
{
|
|
int num;
|
|
float score1;
|
|
float score2;
|
|
float score3;
|
|
float score;
|
|
}student1,student2,student3;
|
|
scanf("%d%f%f%f",&student1.num,&student1.score1,&student1.score2,&student1.score3);
|
|
scanf("%d%f%f%f",&student2.num,&student2.score1,&student2.score2,&student2.score3);
|
|
scanf("%d%f%f%f",&student3.num,&student3.score1,&student3.score2,&student3.score3);
|
|
printf("%d %4.1f %4.1f %4.1f %4.1f\n",student1.num,student1.score1,student1.score2,student1.score3,sum(student1.score1,student1.score2,student1.score3));
|
|
printf("%d %4.1f %4.1f %4.1f %4.1f\n",student2.num,student2.score1,student2.score2,student2.score3,sum(student2.score1,student2.score2,student2.score3));
|
|
printf("%d %4.1f %4.1f %4.1f %4.1f\n",student3.num,student3.score1,student3.score2,student3.score3,sum(student3.score1,student3.score2,student3.score3));
|
|
return 0;
|
|
}
|
|
|
|
float sum(float a,float b,float c)
|
|
{
|
|
float sum;
|
|
sum=a+b+c;
|
|
return sum;
|
|
}
|