PROGRAM Dev_stand IMPLICIT NONE REAL, ALLOCATABLE, DIMENSION(:) :: X INTEGER :: n_elts, istat REAL :: Std_Dev WRITE(*,*) "Quanti elementi ha il vettore X?" READ(*,*) n_elts ALLOCATE(X(n_elts) ,STAT=istat) IF (istat .NE.0) THEN WRITE(*,*) "Allocazione fallita" ELSE WRITE(*,*) "Inserisci i ",n_elts," numeri" READ(*,*) X WRITE(*,*) "Std Dev = ", Std_Dev(x,N_ELTS) DEALLOCATE(X) END IF STOP END PROGRAM Dev_stand REAL FUNCTION Std_Dev(vect,n) IMPLICIT NONE INTEGER :: n REAL, DIMENSION(n) :: vect REAL :: mean mean = SUM(vect)/REAL (n) Std_Dev = SQRT(SUM((vect-mean)**2)/REAL(n)) END FUNCTION Std_Dev