Write a program on Python to find area of a triangle using Heron's formula. (value to be entered by user)
Answers
Semi-Perimeter of a Triangle with sides a,b,c is given by:
S = (a + b + c)/2
Area of triangle is given by:
Area = √s(s - a)(s - b)(s - c)
Sample Python Program to find Area of triangle:
import math
a = float(input('Enter 1st side: '))
b = float(input('Enter 2nd side: '))
c = float(input('Enter 3rd side: '))
s = (a + b + c)/2
Area = math.sqrt (s * (s - a) * (s - b) * (s - c))
print("Area of the triangle is %0.2f: " %Area)
Output:
Enter 1st side: 15
Enter 2nd side: 10
Enter 3rd side: 5
Area of the triangle is 20.69
Hope it helps!
Semi-Perimeter of a Triangle with sides a,b,c is given by:
S = (a + b + c)/2
Area of triangle is given by:
Area = √s(s - a)(s - b)(s - c)
Sample Python Program to find Area of triangle:
import math
a = float(input('Enter 1st side: '))
b = float(input('Enter 2nd side: '))
c = float(input('Enter 3rd side: '))
s = (a + b + c)/2
Area = math.sqrt (s * (s - a) * (s - b) * (s - c))
print("Area of the triangle is %0.2f: " %Area)
Output:
Enter 1st side: 15
Enter 2nd side: 10
Enter 3rd side: 5
Area of the triangle is 20.69
Hope it helps!
Read more on Brainly.in - https://brainly.in/question/9830494#readmore