Write a python program to calculate area of a right angled triangle. Get the input of height and base from the user.
Answers
Answer :
This python program allows the user to enter width and height of the right angled triangle. Using those values we will calculate the Area and perimeter of the right angled triangle.
Explanation :
# Python Program to find Area of a Right Angled Triangle
import math
width = float(input('Please Enter the Width of a Right Angled Triangle: '))
height = float(input('Please 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("\n Area 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)
Hope it will help you....
Answer:
height=eval(input("enter the height of right angle triangle:"))
base=eval(input("enter the base of right angle triangle:"))
area=1/2*base*height
print("area of the right angle triangle is", area)