I’m trying to write a program to calculate triangles. Can anyone give me a short code in F# sharp for this calculation?

This is what I have so far, but I’m not convinced it’s the best way:
let area a b c =
let s = sqrt((a + b + c) / 2)
sqrt(s * (s - a) * (s - b) * (s - c))
It seems you’re trying to apply different formulas depending on the type of triangle you have. If you have three sides you use Heron’s formula, if you have one side you’re assuming the triangle is equilateral, if you have two sides you’re assuming the triangle is right and the two sides are the catheti.
If I interpreted correctly, I would define a discriminated union, like this: