R : 48 characters
f=function(a,b,c){prod((a+b+c)/2-c(0,a,b,c))^.5} Using Heron's formula as well but taking advantage of R's vectorization.
Usage:
f(2,3,4) [1] 2.904738 f(3,4,5) [1] 6 f=function(a,b,c){prod((a+b+c)/2-c(0,a,b,c))^.5} Using Heron's formula as well but taking advantage of R's vectorization.
Usage:
f(2,3,4) [1] 2.904738 f(3,4,5) [1] 6