Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. """
  2. Surface area and Volume of octagonal prism
  3. Author : Daniel Herrmann
  4. """
  5.  
  6. title = "Right Regular Octagonal Prism Surface Area and Volume Calculator"
  7. print("*" * len(title))
  8. print(title)
  9. print("*" * len(title))
  10. print("")
  11.  
  12. import math
  13.  
  14. value_1 = input("Enter a base edge value : ")
  15. value_2 = input("Enter the height of prism : ")
  16. print("")
  17.  
  18. a = int(value_1)
  19. h = int(value_2)
  20.  
  21. area_of_prism = 8*a*h+4*(1+math.sqrt(2))*a**2
  22.  
  23. answer_area = str(round(area_of_prism, 3))
  24.  
  25. volume_of_prism = 2*(1+math.sqrt(2))*a**2*h
  26.  
  27. answer_volume = str(round(volume_of_prism,3))
  28.  
  29.  
  30. print("Base Edge :", value_1)
  31. print("Height :", value_2)
  32. print("")
  33.  
  34.  
  35. print("Surface area : ", answer_area)
  36. print("Volume", answer_volume)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement