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.
Write a program that outputs the area and circumference of a circle from the diameter.
Use this boilerplate code as a starting point:
Remember to add a comment before a subprogram or selection statement to explain its purpose.
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
Use these resources as a reference to help you meet the success criteria.
Run the unit tests below to check that your program has met the success criteria.
Enter the diameter of the circle: 10
Area: 78.5
Circumference: 31.400000000000002
Enter the diameter of the circle: 5
Area: 19.625
Circumference: 15.700000000000001
Check that you have used comments within the code to describe the purpose of subprograms.