!-----  Ex5_4: Mean and Standard Deviation   -----
      INTEGER :: n=0, i, mark
      REAL :: w = 0.0, v = 0.0, mean, sd
      DO
         PRINT*, "点数（整数：終了は負の数）は？"
         READ*, mark
                          IF(mark < 0) EXIT
         n = n + 1;   w = w + mark;   v = v + mark**2
      END DO
      IF(n>0) THEN
         mean = w/n ;   sd = SQRT(v/n - mean**2)
         PRINT '( "平均点  ＝", F5.1)', mean
         PRINT '( "標準偏差＝", F5.1)', sd
      ENDIF
         PRINT '( "生徒総数＝", I5)', n
      END