Hamilton LaboratoriesHamilton C shell 2012User guideSamples

percentchg.csh

Oregon Coast

percentchg.csh
Previous | Next

#  Calculate the percentage change between an old value and a new value
#  Copyright (c) 2008-2012 by Hamilton Laboratories.  All rights reserved.

proc percentchg( oldvalue, newvalue )
   if (oldvalue == 0) then
      echo -2 percentchg:  The old value cannot be 0
      @ status = 1
   else
      return 100 * (newvalue - oldvalue)/oldvalue
   end
end

percentchg $argv

Previous | Next