# This routine computes the mean and the standard deviation of set of nu

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48``` ```{This routine computes the mean and the standard deviation of a set of numbers} program means; {find mean and standard deviation } uses sampler; const max = 100; PName: String[9] = 'inputpas.pas'; type ary = array[1..max]of real; var x : ary; i,n : integer; mean,std : real; procedure meanstd (x : ary; {array of values} length : integer; var mean : real; var std_dev : real); var i : integer; sum_x,sum_sq,xt : real; begin Sample(PName,23); sum_x:=0; sum_sq:=0; Sample(PName,27); Sample(PName,27); for i:=1 to length do begin xt:= x[i] ; sum_x:=sum_x+xt; sum_sq:=sum_sq + xt*xt end; Sample(PName,33); Sample(PName,34); mean:=sum_x/length; std_dev:=sqrt((sum_sq-sqr(sum_x)/length)/(length-1)); Sample(PName,42); end { procedure meanstd }; begin { MAIN program } Sample(PName,35); n:=max; randomize; Sample(PName,38); Sample(PName,39); for i:=1 to n do x[i]:= random(100); Sample(PName,42); meanstd(x,n,mean,std); Sample(PName,42); end. { MAIN program } ```