home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng)
/
ProfitPress-MegaCDROM2.B6I
/
PROG
/
PASCAL
/
NRPAS13.ZIP
/
MDIAN1.PAS
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
Pascal/Delphi Source File
|
1991-04-29
|
329 b
|
14 lines
PROCEDURE mdian1(VAR x: narray; n: integer; VAR xmed: real);
(* Program using routine MDIAN1 must define the type
TYPE
narray = ARRAY [1..n] OF real;
in the calling routine *)
VAR
n2: integer;
BEGIN
sort(n,x);
n2 := n DIV 2;
IF (2*n2 = n) THEN xmed := 0.5*(x[n2]+x[n2+1])
ELSE xmed := x[n2+1]
END;