In this python program, we will learn how to calculate the area of a right-angled triangle.
A right triangle or right-angled triangle is a triangle in which one angle is a right angle. In other words, we can say that the right angle triangle is a triangle in which one angle is a 90o angle. The relation between the sides and angles of a right triangle is the basis for trigonometry. The side opposite the right angle is called the hypotenuse. The sides adjacent to the right angle are called legs.
Area of the Right AngledTriangle = 0.5 * (a * b)
Here is the source code of the program to calculate the area of a right-angled triangle.
# Python Program to Calculate the Area of a Right Angled Triangle
# Area = 1/2*width*height
# Import Module
import math
# Take the Input From the User
width = float(input("Enter the Width of a Right Angled Triangle: "))
height = float(input("Enter the Height of a Right Angled Triangle: "))
# Calculate the Area
Area = 0.5 * width * height
# Calculate the Third Side
c = math.sqrt((width*width) + (height*height))
# Calculate the Perimeter
Perimeter = width + height + c
# Print the output
print("\nArea of a right angled triangle is: %.2f" %Area)
print("Other side of right angled triangle is: %.2f" %c)
print("Perimeter of right angled triangle is: %.2f" %Perimeter)
Enter the Width of a Right Angled Triangle: 5
Enter the Height of a Right Angled Triangle: 6
Area of a right angled triangle is: 15.00
Other side of right angled triangle is: 7.81
Perimeter of right angled triangle is: 18.81
Comments