27 lines
480 B
Text
27 lines
480 B
Text
real
|
|
mean(list l)
|
|
{
|
|
integer i;
|
|
real x, y;
|
|
|
|
x = y = 0;
|
|
|
|
i = 0;
|
|
while (i < l_length(l)) {
|
|
x += Gcos(l[i]);
|
|
y += Gsin(l[i]);
|
|
i += 1;
|
|
}
|
|
|
|
return Gatan2(y / l_length(l), x / l_length(l));
|
|
}
|
|
|
|
integer
|
|
main(void)
|
|
{
|
|
o_form("mean of 1st set: /d6/\n", mean(l_effect(350, 10)));
|
|
o_form("mean of 2nd set: /d6/\n", mean(l_effect(90, 180, 270, 360)));
|
|
o_form("mean of 3rd set: /d6/\n", mean(l_effect(10, 20, 30)));
|
|
|
|
return 0;
|
|
}
|