0% found this document useful (0 votes)
5 views2 pages

Python Program

The document contains Python code for calculating the area of a triangle using Heron's formula and the area of a rectangle through multiplication of length and breadth. It prompts the user for the lengths of the sides of the triangle and the dimensions of the rectangle. The code then computes and prints the respective areas based on the user inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Program

The document contains Python code for calculating the area of a triangle using Heron's formula and the area of a rectangle through multiplication of length and breadth. It prompts the user for the lengths of the sides of the triangle and the dimensions of the rectangle. The code then computes and prints the respective areas based on the user inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

s1 = int(input("Enter length of side 1 of the triangle: "))

s2 = int(input("Enter length of side 2 of the triangle: "))

s3 = int(input("Enter length of side 3 of the triangle: "))

s = (s1+s2+s3)/2

area = (s*(s-s1)*(s-s2)*(s-s3))**0.5

print('Area of the given triangle is', area)

length = float(input('Enter length := ')) # read length

breadth = float(input('Enter breadth := ')) # read breadth

area = length * breadth # computation

print('Area of the Rectangle := ', area)

Enter Length of Rectangle:

Enter Breadth of Rectangle:

Enter the first side of the triangle = 5

Enter the second side of the triangle = 5

Enter the third side of the triangle = 5

You might also like