Write a program to compute the area of a circle some 'n' times. You must accept n and r from the user. Area is calculated using (22/7.0)*r*r - where r is the radius. Implement using value-returning functions. Hint: create a function to calculate area taking r as a parameter. In the main() function, ask for n and create a loop where you input r and invoke the area function n times.

Respuesta :

In python:

def calculateRadius(r):

   return (22 / 7) * r * r

def main():

   quantity = int(input("How many times do you want to calculate the are? "))

   radius = float(input("What's the radius of your circle? "))

   i = 0

   while i < quantity:

       calculateRadius(radius)

       i += 1

if __name__ == "__main__":

   main()

I hope this helps!