#include<stdio.h>
#include<math.h>
double heikin(int a[]);
int goukaku(int a[],int b);
void hensachi(int data[],double dev[],double ave);
int main(void)
{
int data[5],i;
double ave;
double deviation[5];
for (i=0;i<=4;i++)
{
}
ave=heikin(data);
printf("goukaku=%d\n",goukaku
(data
,5)); hensachi(data,deviation,ave);
for (i=0;i<=4;i++)
{
printf("deviation[%d]=%f\n",i
,deviation
[i
]); }
return 0;
}
double heikin(int a[])
{
int i,k=0;
for(i=0;i<=4;i++)
{
k=k+a[i];
}
return((double)k/5);
}
int goukaku(int a[], int b)
{
int n=0;
for(;b!=0;--b)
if(a[b-1] >= 6)
++n;
return n;
}
void hensachi(int data[],double dev[],double ave)
{
int i;
double stddev,d=0;
for (i=0;i<=4;i++)
{
}
printf("Standard Deviation=%f\n",stddev
); for (i=0;i<=4;i++)
{
dev[i]=10*(data[i]-ave)/stddev+50;
}
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8bWF0aC5oPgoKZG91YmxlIGhlaWtpbihpbnQgYVtdKTsKaW50IGdvdWtha3UoaW50IGFbXSxpbnQgYik7CnZvaWQgaGVuc2FjaGkoaW50IGRhdGFbXSxkb3VibGUgZGV2W10sZG91YmxlIGF2ZSk7CgppbnQgbWFpbih2b2lkKQp7CiBpbnQgZGF0YVs1XSxpOwogZG91YmxlIGF2ZTsKIGRvdWJsZSBkZXZpYXRpb25bNV07CiBmb3IgKGk9MDtpPD00O2krKykKIHsKICBwcmludGYoImRhdGFbJWRdPSBcbiIsaSk7CiAgc2NhbmYoIiVkIiwmZGF0YVtpXSk7CiB9CiBhdmU9aGVpa2luKGRhdGEpOwogcHJpbnRmKCJoZWlraW49JWYgXG4iLGF2ZSk7CiBwcmludGYoImdvdWtha3U9JWRcbiIsZ291a2FrdShkYXRhLDUpKTsKIGhlbnNhY2hpKGRhdGEsZGV2aWF0aW9uLGF2ZSk7CiBmb3IgKGk9MDtpPD00O2krKykKIHsKICBwcmludGYoImRldmlhdGlvblslZF09JWZcbi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