PROGRAM Statistics

! Written by Kate T-C
! February 11,2009  For the Fortran Short Course
! This program demonstrates basic array usage and some 
!   built-in statistical functions in Fortran

implicit none

real, dimension(5) :: data = (/1.0,2.0,3.0,4.0,5.0/)   ! My data array

! Print the data at specific indexes
print *, 'second data val=', data(2), 'second-to-last data val=', data(ubound(data)-1)

! Play with some built-in fortran functions
print *, 'max data val=', maxval(data), 'min data val=', minval(data)
print *, 'sum of data=', sum(data), 'product of data=', product(data)

! One way to compute the mean
print *, 'mean of data=', sum(data)/size(data)


END PROGRAM Statistics
