subroutine minmax(n,vector,vmin,vmax) c c finds the minimum and maximum of the vector of length n, and c stores the results in vmin and vmax (unless vmin or vmax c already exceed this new minimum and maximum). c c Written by Greg Hammett 29-Jan-1991 c implicit none ! force every variable's type to be declared. ! (This is useful as a check for typographical errors.) c declare arguments: integer n real vector(n) real vmin real vmax c declare local variables: integer i if (n .ge. 1) then do 10 i=1,n vmin=min(vmin,vector(i)) vmax=max(vmax,vector(i)) 10 continue endif return end