Computer Science, asked by ronakpatel2599, 9 months ago

6. Write a python program to calculate Area of a triangle with Base and Height.

[Base:30 Height:60 Area:900]​

Answers

Answered by amansingh682006
19

Answer:

Program :

b = float(input('Enter base of a triangle: '))

h = float(input('Enter height of a triangle: '))

area = (b * h) / 2.

Answered by Tulsi4890
0

def triangle_area(base, height):

return (base * height) / 2

base = 30

height = 60

area = triangle_area(base, height)

print("Area of triangle with base", base, "and height", height, "is", area)

  • This program calculates the area of a triangle using the formula (base * height) / 2.
  • The base and height of the triangle are defined as variables at the top of the program and passed as arguments to the triangle_area function.
  • The result of the calculation is then returned by the function and stored in the variable "area."
  • Finally, the program prints out the area of the triangle using the values of the base and height variables.

Explanation:

  • Define a function triangle_area() which takes 2 parameters base and height.
  • return the multiplication of base and height divide by 2.
  • Define two variables base and height and assign values.
  • Using the function triangle_area() find the area of the triangle.
  • print the area of the triangle.

To learn more about python from the given link.

https://brainly.in/question/16086632

#SPJ3

Similar questions