Heron's formula

Report a typo

Many years ago, when Paul went to school, he did not like using Heron's formula to calculate the area of a triangle, because he considered it to be very complex. One day he decided to help all the students in his school by writing a program that calculated the area of a triangle by its three sides.

However, there was a problem: as Paul did not like the formula, he did not memorize it. Help him finish this act of kindness and write the program following Heron's formula:

S=p(pa)(pb)(pc) S=\sqrt{p(p - a)(p - b)(p - c)} where p=a+b+c2 p=\dfrac{a + b + c}2 is a half-perimeter of the triangle. On the input, the program has integers, and the output should be a real number corresponding to the area of the triangle.

Do NOT round the result.

Sample Input 1:

3
4
5

Sample Output 1:

6.0
Write a program in Python 3
# put your python code here
___

Create a free account to access the full topic