	SUBROUTINE MEDN(A,MED)
	DIMENSION A(500)
	LOGICAL*1 Y(3)
	REAL MED
	REWIND 1	
C	THE FOLLOWING STATEMENTS COMPUTE THE MEDIAN BY FIRST PUTTING
C	THE DATA VALUES IN ASCENDING ORDER, AND THEN TEST, TO DETERMINE
C	IF THE NUMBER OF DATA POINTS, N, IS ODD OR EVEN.  IF N IS ODD,
C	N/2 IS COMPUTED, CHANGED TO AN INTEGER, THEN INCREMENTED BY 1
C	TO YIELD THE APPROPRIATE N FOR THE MEDIAN.  IF N IS EVEN, N/2
C	IS AGAIN COMPUTED AND CHANGED TO AN INTEGER.  THE DATA VALUE
C	WHICH CORRESPONDS TO THAT N, IS THEN AVERAGED WITH THE VALUE
C	WHICH CORRESPONDS TO N+1, TO ARRIVE AT THE MEDIAN.
	N=0
3	N=N+1
	READ(1,5,END=10)A(N)
5	FORMAT(1X,F10.4)
	GO TO 3
10	N=N-1
	INN=N-1
	DO 20 IK=1,INN
	IN=IK+1
	DO 20 IJ=IN,N
	IF(A(IK).LE.A(IJ))GO TO 20
	AT=A(IK)
	A(IK)=A(IJ)
	A(IJ)=AT
20	CONTINUE
	I=N/2
	J=I*2
	IF(J.EQ.N)GO TO 25
	K=I+1
	MED=A(K)
	GO TO 30
25	K=I+1
	MED=(A(I)+A(K))/2
30	WRITE(5,35)MED
35	FORMAT(' THE MEDIAN=',F10.4)
40	WRITE(5,45)
45	FORMAT(1X,'DO YOU WANT A HARD COPY? YES/NO'$)
	READ(5,50)(Y(J),J=1,3)
50	FORMAT(3A1)
	IF(Y(1).EQ.'Y')GO TO 60
	IF(Y(1).EQ.'N')GO TO 70
	WRITE(5,55)
55	FORMAT(1X,' ERROR, PLEASE TRY AGAIN')
	GO TO 40
60	WRITE(6,65)MED
65	FORMAT(1X,' THE MEDIAN=',F10.4)
70	RETURN	
	END
