forked from SushmitaY/mca101_2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.area_triangle.py
More file actions
35 lines (25 loc) · 968 Bytes
/
4.area_triangle.py
File metadata and controls
35 lines (25 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def areaTriangle( base , height ):
'''
objective : to calculate the area of a triangle
approach : multiplying base, height together and then taking half of it
parameteres : -> base : base of triangle
-> height : height of triangle
return value : area of the triangle
'''
area = 0.5 * base * height
return area
def main():
'''
objective : to calculate the area of a triangle
approach : taking base and height of triangle as input from user and passing them to function areaTriangle
'''
base = int( input('Enter base of triangle : ') )
height = int( input('Enter height of triangle : ') )
area = areaTriangle( base , height)
print(' Base of triangle : ' , base)
print(' Height of triangle : ' , height)
print(' Area of triangle : ', area)
print(' End of main ')
if __name__ == '__main__':
main()
print(' End of program ')