Program for Volume and Surface area of Frustum of Cone | Python3 code to calculate Volume and Surface area of frustum of cone ; Function to calculate Volume of frustum of cone ; Function to calculate Curved Surface area of frustum of cone ; Function to calculate Total Surface area of frustum of cone ; Driver Code ; Printing value of volume and surface area
import math NEW_LINE pi = math . pi NEW_LINE def volume ( r , R , h ) : NEW_LINE INDENT return 1 / 3 * pi * h * ( r * r + R * R + r * R ) NEW_LINE DEDENT def curved_surface_area ( r , R , l ) : NEW_LINE INDENT return pi * l * ( R + r ) NEW_LINE DEDENT def total_surface_area ( r , R , l , h ) : NEW_LINE INDENT return pi * l * ( R + r ) + pi * ( r * r + R * R ) NEW_LINE DEDENT small_radius = 3 NEW_LINE big_radius = 8 NEW_LINE slant_height = 13 NEW_LINE height = 12 NEW_LINE print ( " Volume ▁ Of ▁ Frustum ▁ of ▁ Cone ▁ : ▁ " , end = ' ' ) NEW_LINE print ( volume ( small_radius , big_radius , height ) ) NEW_LINE print ( " Curved ▁ Surface ▁ Area ▁ Of ▁ Frustum " + " ▁ of ▁ Cone ▁ : ▁ " , end = ' ' ) NEW_LINE print ( curved_surface_area ( small_radius , big_radius , slant_height ) ) NEW_LINE print ( " Total ▁ Surface ▁ Area ▁ Of ▁ Frustum " + " ▁ of ▁ Cone ▁ : ▁ " , end = ' ' ) NEW_LINE print ( total_surface_area ( small_radius , big_radius , slant_height , height ) ) NEW_LINE