-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcalAreaTriangle.py
33 lines (29 loc) · 944 Bytes
/
calAreaTriangle.py
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
#P3. WAP to print area of triangle taking base & height of triangle as user inputs.
def areaTriangle(base, height):
'''
Objective : To compute the area of a triangle
Input Parameters :
base: Base of triangle
height: Height of triangle
return: area of triangle
'''
#approach: multiply 0.5 and base and height
area = 0.5*base*height
return area
def main():
'''
Objective : to compute the area of a triangle
User Inputs :
base: Base of triangle
height: Height of triangle
'''
#approach: use function areaTriangle
base = int(input('Enter base of Triangle: '))
height = int(input('Enter Height of Triangle: '))
print('base of Triangle: ', base)
print('Height of Triangle: ', height)
print('Area of Triangle: ', areaTriangle(base, height))
print('End of Output')
if __name__ == '__main__':
main()
print('Program Ends..!')