Skip to content

Commit 8ebd320

Browse files
Update AreaTriangle
1 parent 99cf7d7 commit 8ebd320

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

AreaTriangle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,21 @@ s = (a + b + c) / 2
88
# calculate the area
99
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
1010
print('The area of the triangle is %0.2f' %area)
11+
or
12+
# Python Program to find the area of triangle
13+
14+
a = 5
15+
b = 6
16+
c = 7
17+
18+
# Uncomment below to take inputs from the user
19+
# a = float(input('Enter first side: '))
20+
# b = float(input('Enter second side: '))
21+
# c = float(input('Enter third side: '))
22+
23+
# calculate the semi-perimeter
24+
s = (a + b + c) / 2
25+
26+
# calculate the area
27+
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
28+
print('The area of the triangle is %0.2f' %area)

0 commit comments

Comments
 (0)