Thursday, 19 September 2024

Practical - 65 - Write a Python program to take sides of a triangle as input and print its area using Heron's Formula.

Practical - 65 - Write a Python program to take sides of a triangle as input and print its area using Heron's Formula.


Ans:

a=int(input("Enter First side of triange: "))

b=int(input("Enter Second side of triange: "))

c=int(input("Enter Third side of triange: "))

s=(a+b+c)/2

area=(s*(s-a)*(s-b)*(s-c))**0.5

print("Area of triangle=",area)

 

Output:

Enter First side of triange: 3

Enter Second side of triange: 4

Enter Third side of triange: 5

Area of triangle= 6.0


No comments:

Post a Comment