Averages/Arithmetic mean: Difference between revisions

Content added Content deleted
Line 129: Line 129:
=={{header|Fortran}}==
=={{header|Fortran}}==
In ISO Fortran 90 or later, use the SUM intrinsic, the SIZE intrinsic and the MAX intrinsic (to avoid divide by zero):
In ISO Fortran 90 or later, use the SUM intrinsic, the SIZE intrinsic and the MAX intrinsic (to avoid divide by zero):
REAL, DIMENSION(100) :: A = (/ (i, i=1, 100) /)
REAL, TARGET, DIMENSION(100) :: A = (/ (i, i=1, 100) /)
REAL, DIMENSION(5,20) :: B = RESHAPE( A, (/ 5,20 /) )
REAL, DIMENSION(5,20) :: B = RESHAPE( A, (/ 5,20 /) )
REAL, POINTER, DIMENSION(:) :: P => A(2:1) ! pointer to zero-length array
REAL, POINTER, DIMENSION(:) :: P => A(2:1) ! pointer to zero-length array