#include<stdio.h>
#include<math.h>
#define STUDENTS 5
#define EXAMS 3
typedef struct{
int id;
int math;
int english;
int physics;
double ave;
double std;
}Grades;
int main(void){
Grades data[]={
{1,65,80,95},
{2,70,68,75},
{3,60,100,83},
{4,100,55,74},
{5,90,85,100}};
for (int i=0; i<STUDENTS; i++){
data[i].ave=(data[i].math + data[i].english + data[i].physics) / EXAMS;
data
[i
].
std=sqrt(((data
[i
].
math - data
[i
].
ave)*(data
[i
].
math - data
[i
].
ave))+((data
[i
].
english - data
[i
].
ave)*(data
[i
].
english - data
[i
].
ave))+((data
[i
].
physics - data
[i
].
ave)*(data
[i
].
physics - data
[i
].
ave)))/ EXAMS
; printf("id %d : ave %lf : std %lf\n",data
[i
].
id,data
[i
].
ave,data
[i
].
std); }
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8bWF0aC5oPgojZGVmaW5lIFNUVURFTlRTIDUKI2RlZmluZSBFWEFNUyAzCgp0eXBlZGVmIHN0cnVjdHsKICAgIGludCBpZDsKICAgIGludCBtYXRoOwogICAgaW50IGVuZ2xpc2g7CiAgICBpbnQgcGh5c2ljczsKICAgIGRvdWJsZSBhdmU7CiAgICBkb3VibGUgc3RkOwp9R3JhZGVzOwoKaW50IG1haW4odm9pZCl7CiAgICBHcmFkZXMgZGF0YVtdPXsKICAgICAgICB7MSw2NSw4MCw5NX0sCiAgICAgICAgezIsNzAsNjgsNzV9LAogICAgICAgIHszLDYwLDEwMCw4M30sCiAgICAgICAgezQsMTAwLDU1LDc0fSwKICAgICAgICB7NSw5MCw4NSwxMDB9fTsKCiAgICBmb3IgKGludCBpPTA7IGk8U1RVREVOVFM7IGkrKyl7CiAgICAgICAgZGF0YVtpXS5hdmU9KGRhdGFbaV0ubWF0aCArIGRhdGFbaV0uZW5nbGlzaCArIGRhdGFbaV0ucGh5c2ljcykgLyBFWEFNUzsKICAgICAgICBkYXRhW2ldLnN0ZD1zcXJ0KCgoZGF0YVtpXS5tYXRoIC0gZ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