parameter(max=100000) real*4 x(max) * read the data into x open(1,file='/home/sgao/demo/07_f77/a.dat') do i=1,max read(1,*,end=111) x(i) enddo 111 close(1) npts=i-1 ** Now get the mean av=0.0 do i=1,npts av=av+x(i) enddo av=av/npts print*,'The mean is ', av,'; total us ', av*npts stop end