Area of a triangle in python

2022-12-29 17:25:00
Python 3 hashnode
Area of a triangle in python

Example

Input 5 5 Output 5

Explanation

  1. Take base and height as input from the user.
  2. Use the formula to find the area of the triangle.
  3. Store the area in a resultant variable like area_of_traingle.
  4. Print the result

Formula to be used

area of a triangle = (base * height)/2

Program

base = float(input("enter the base")) 
height = float(input("enter the height")) 
area_of_triangle = (base * height)/2 
print(area_of_triangle)

© 2022 开源博客 京ICP备20030565号-2 Powered by Quick API team