From ffe67192a0d67207c97a3424c0c89e805f28e651 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Fri, 7 Mar 2014 17:54:24 +0100 Subject: median --- median | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 median (limited to 'median') diff --git a/median b/median new file mode 100755 index 0000000..3797164 --- /dev/null +++ b/median @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +require 'nlp_ruby' + + +a = [] +while line = STDIN.gets + a << line.to_f +end + +a.sort! + +puts a[a.size/2] + -- cgit v1.2.3