triangle formula code example Example 1: triangle area formula double traingleArea = base * height / 2; Example 2: triangle its not real