RosettaCodeData/Task/Averages-Mean-angle/PL-I/averages-mean-angle.pli
2023-07-01 13:44:08 -04:00

18 lines
605 B
Text

averages: procedure options (main); /* 31 August 2012 */
declare b1(2) fixed initial (350, 10);
declare b2(4) fixed initial (90, 180, 270, 360);
declare b3(3) fixed initial (10, 20, 30);
put edit ( b1) (f(7));
put edit ( ' mean=', mean(b1) ) (a, f(7) );
put skip edit ( b3) (f(7));
put edit ( ' mean=', mean(b3) ) (a, f(7) );
put skip edit ( b2) (f(7));
put edit ( ' mean=', mean(b2) ) (a, f(7) );
mean: procedure (a) returns (fixed);
declare a(*) float (18);
return ( atand(sum(sind(a))/hbound(a), sum(cosd(a))/hbound(a) ) );
end mean;
end averages;