/*

      gmean - Numerator program to calculate the geometric mean of
              a series of numbers.  The geometric mean is defined 
              as the nth root of the product of n values.

          Set the verbose variable to a non-zero value 

               verbose = 1

          to make queries and produce other prompts.  Otherwise, this
          file can be used like a function.
*/


if (verbose) 
   "Enter next number\n"
   "Enter 0 to end list\n"
endif
get val

tot = (tot == 0) ? 1 : tot

if (val != 0)
   tot = tot * val
   items = items + 1
   do "gmean"
endif
if (verbose)
   "Geometric mean = "
endif
tot ^ (1 / items)
tot = 0
items = 0
