MEANSIGMA

 !Program name: MEANSIGMA

!Calculation of arithmetic mean and standard deviation

    Parameter(IMAX=100)

    REAL*8 X(IMAX),SUM,SSQ,MI,SIGMA

    SUM=0

    N=0

    Do 1 I=1,IMAX

       write(0,10)

10    Format('Input the N values of X (type 000 when finished): ',$)

       Read(5,*) X(I)

          If(X(I) .eq. 000) then

            go to 2

          end if

       SUM=SUM+X(I)

       N=N+1

1   continue

2   MI=SUM/DFLOAT(N)

    SSQ=0

    Do 3 I=1,N

       SSQ=SSQ+(X(I)-MI)**2

3   continue

    SIGMA=DSQRT(SSQ/DFLOAT(N-1))

    Write(6,20) MI,SIGMA

20 format(/'mean= ',F7.3/'standard deviation= ',F5.3)

    stop

    end

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA