19.0k views
5 votes
Write a function that calculates the area of, a circle when its circumference, c, is given . This function should call a second function that returns the radius, r, of the circle, given c. The relevant formulas are r= c/2π and a= πr2.

User JCBrown
by
5.1k points

1 Answer

1 vote

Answer:

Written in Python

def Areas(radius):

pi = 22.0/7.0

Area = pi * radius**2

print("The area is: "+str(Area))

def Radius(circum):

pi = 22.0/7.0

radius = circum/(2 * pi)

Areas(radius)

Step-by-step explanation:

The first function is defined as thus: The parameter in the bracket, radius, is returned from the second function

def Areas(radius):

This line initializes pi to 22/7

pi = 22.0/7.0

This line calculates the area of the circle

Area = pi * radius**2

This line prints the area of the circle

print("The area is: "+str(Area))

The second function is defined as thus: It gets the circumference from the main and returns the radius to the function defined above

def Radius(circum):

This line initializes pi to 22/7

pi = 22.0/7.0

This line calculates the radius of the circle

radius = circum/(2 * pi)

This line returns the radius of the first function

Areas(radius)

To return the proper result, the Radius function must first be called using the following syntax.

Radius(any digit)

Example

Radius(60)

User Nudier Mena
by
6.4k points