fork download
  1. import math
  2.  
  3. def area_circle(r):
  4. return math.pi * r * r
  5.  
  6. def area_rectangle(a, b):
  7. return a * b
  8.  
  9. def area_triangle(a, h):
  10. return a * h / 2
  11.  
  12. def area_trapezoid(a, b, h):
  13. return (a + b) * h / 2
  14.  
  15.  
  16. choice = int(input())
  17.  
  18. if choice == 1:
  19. r = float(input())
  20. print(area_circle(r))
  21.  
  22. elif choice == 2:
  23. a, b = map(float, input().split())
  24. print(area_rectangle(a, b))
  25.  
  26. elif choice == 3:
  27. a, h = map(float, input().split())
  28. print(area_triangle(a, h))
  29.  
  30. elif choice == 4:
  31. a, b, h = map(float, input().split())
  32. print(area_trapezoid(a, b, h))
  33.  
Success #stdin #stdout 0.02s 7288KB
stdin
1
5
2
4 6
3
6 4
4
3 5 4


stdout
78.5398163397