Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- a = float(input('Enter a: '))
- b = float(input('Enter b: '))
- c = float(input('Enter c: '))
- if a <= 0 or b <= 0 or c <= 0 or a + b <= c or a + c <= b or b + c <= a:
- print('Invalid triangle')
- else:
- P = a + b + c
- p = P / 2
- S = math.sqrt(p*(p-a)*(p-b)*(p-c))
- print('P = ' + str(P))
- print('S = ' + str(S))
Add Comment
Please, Sign In to add comment