10 PRINT "MEAN, VARIANCE, STANDARD DEVIATION"
20 PRINT
30 PRINT "WHICH METHOD (0=POPULATION,1=SAMPLE)";
40 INPUT S
50 PRINT "KIND OF DATA (0=GROUPED,1=UNGROUPED)";
60 INPUT K
70 PRINT "NUMBER OF OBSERVATIONS";
80 INPUT N
90 R=0
100 M=0
110 P=0
120 IF K=1 THEN 230
129 REM - FOR GROUPED DATA
130 FOR I=1 TO N
140 PRINT "ITEM, FREQUENCY";I;
150 INPUT A,B
159 REM - ACCUMULATE ENTERED VALUES
160 R=R+B*A
169 REM - ACCUMULATE INTERMEDIATE VALUES FOR VARIANCE
170 P=P+B
180 M=M+B*A[2
190 NEXT I
199 REM - CALCULATE MEAN AND VARIANCE
200 R=R/P
210 V=(M-P*R[2)/(P-S)
219 REM - PRINT RESULTS
220 GOTO 310
229 REM - FOR UNGROUPED DATA
230 FOR I=1 TO N
240 PRINT "ITEM";I;
250 INPUT D
259 REM - ACCUMULATE INTERMEDIATE VALUES FOR VARIANCE
260 P=P+D
269 REM - ACCUMULATE INTERMEDIATE VALUES FOR VARIANCE
270 M=M+D[2
280 NEXT I
289 REM - CALCULATE MEAN AND VARIANCE, PRINT
290 R=P/N
300 V=(M-N*R[2)/(N-S)
310 PRINT
319 REM - PRINT RESULTS
320 PRINT "MEAN","VARIANCE","STANDARD DEVIATION"
330 PRINT R,V,SQR(V)
340 PRINT
349 REM - RESTART OR END PROGRAM?
350 PRINT "MORE DATA (1=YES, 0=NO)";
360 INPUT S
370 IF S=1 THEN 20
380 END
