Programming Examples
Python program to calculate the area of an equilateral triangle
Write a program to calculate the area of an equilateral triangle. (area = (√3 / 4) * side * side).
Solution
import math
side = float(input("Enter side: "))
area = math.sqrt(3) / 4 * side * side
print("Area of triangle =", area)
Output
Enter side: 5
Area of triangle = 10.825317547305481