Subprograms to return the properties of a circle.

Written as the Greek letter for p, or π — pi is the ratio of the circumference of any circle to the diameter of that circle. Regardless of the circle’s size, this ratio will always equal pi. The importance of pi has been known for at least 4,000 years. By the start of the 20th century, about 500 digits of pi were known. With computation advances, thanks to computers, we now know more than the first ten trillion digits of pi.

Circle properties

⭐⭐⭐

Make

Write a program that outputs the area and circumference of a circle from the diameter.

Success Criteria

Remember to add a comment before a subprogram or selection statement to explain its purpose.

Create a subprogram called circle_area that:

  1. Takes a parameter: diameter.
  2. Returns the area calculated as 3.14 * (radius * radius). The radius is the diameter divided by 2.

Create a subprogram called circle_circumference that:

  1. Takes a parameter: diameter.
  2. Returns the area calculated as 3.14 * diameter.

Complete the main program so that:

  1. The user can input the diameter of a circle.
  2. It outputs the area and circumference as shown below.

Typical inputs and outputs from the program would be:

Enter the diameter of the circle: 2
Area: 3.14
Circumference: 6.28
Enter the diameter of the circle: 7.3
Area: 41.83265
Circumference: 22.922
Enter the diameter of the circle: 10
Area: 78.5
Circumference: 31.400000000000002
Parsons editor: complete program