Practice Question #3
#Calculate Area of Triangle
gap = ("\n") #Definig gap variable
print(gap * 14) #Making some gap in the consol
base = int(input("What is the length of the base of your triangle:- ")) #getting Base inpute from the user
height = int(input("\nWhat is the height of your triangle:- ")) #getting height input from the user
area = int((1/2) * base * height) #Calculating the final area
print(f"\nArea of your triangle is:- {area}{gap*3}") #Printing the final area
Output
What is the length of the base of your triangle:- 45
What is the height of your triangle:- 23
Area of your triangle is:- 517

Comments
Post a Comment