[ Web Proxy ]
URL:
Viewing: https://programminginpython.com/python-program-area-triangle-base-height/#respond [Back]  [Original]

Python program to find area of triangle (given base and height) - Programming In Python
Skip to content
Home Python program to find area of triangle (given base and height)

Python program to find area of triangle (given base and height)

Python program to find area of triangle (given base and height) [Python program to find area of triangle (given base and height)] Python program to find area of triangle (given base and height)

Hello everybody, welcome back! Here we learn how to find the area of a triangle whenbase and height of a triangle are given.

We calculate the area by multiplying base and height and dividing it with 2. Area = ( base * height ) / 2

You can also watch the video on YouTube here.

We can also calculate area of triangle when all sides are given, using Herons formula. That can be found here.

Program on Github

Area of triangle Code Visualization

Task :

To find the area of a triangle whenbase and height of a triangle are given.

Approach :

  • Read base and heightof a triangleusing input()orraw_input()
  • Multiply both base and height and divide it with 2
  • Area a = ( base * height ) / 2
  • Print the result.

Program on Github

Program :

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

area = (b * h) / 2
print('The area of the triangle is %0.2f' % area)

Output :

Area of a triangle ( base and height ) - programminginpython.com [Area of a triangle ( base and height ) - programminginpython.com]Area of a triangle ( base and height ) programminginpython.com

Program on Github

Course Suggestion

Want to learn python with strong fundamentals? If yes, I strongly suggest you to take the course below.
Course: Fundamentals of Programming in Python

 

Online Python Compiler

Tagged: area of triangle basic math

Post navigation

Leave a Reply Cancel reply

author:
email:
url:
comment:
ak_hp_textarea:

Programming In Python 2026. Powered By BlazeThemes.

Web Proxy Viewer  |  New URL  |  Original Page