Skip to main content
1 of 2
plannapus
  • 9k
  • 23
  • 49

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 
plannapus
  • 9k
  • 23
  • 49