Computer Science, asked by asadsiraj20, 11 months ago

Using python,Write two functions which will take required arguments for calculating the Area and Volume of
cylinder.
note:- The format should be:
print("the volume of the cylinder is{0:.{1}}cm\u00b3".format(volume,decimals))​

Answers

Answered by BushrajavediqbalKhan
1

Explanation:

area = 1256.66

volume = 1254.725

decimals = 2

print("The area of the rectangle is {0:.{1}f}cm\u00b2".format(area, decimals))

decimals = 3

print("The volume of the cylinder is {0:.{1}f}cm\u00b3".format(volume, decimals))

Using mention argument You are interpolating the value once

Answered by suskumari135
2

Calculate the Area and Volume of  a cylinder.

Explanation:

Two functions used in the program:

--volume(r, h)

--area_cylinder(r,h)

Python Program

def volume(r, h):

  pi = 3.14

  vol =  pi * r ** 2 * h

  decimals = 3

  print("The volume of the cylinder is {0:. {1} f} cm \u00b3 ".   format(vol, decimals))

def area_cylinder(r,h):

  pi = 3.14

  surface_area = 2 * pi * r * h + 2 * pi * (r**2)

  decimals = 3

  print("The area of the cylinder is {0:. {1}f}cm\u00b2". format(surface_area,   decimals))

volume(1,2)

area_cylinder(1,2)

Output:

The volume of the cylinder is 6.280 cm³                                            The area of the cylinder is 18.840 cm²  

Similar questions