Programmers and Teachers:
Lesson on Circumference
What is Circumference?
Circumference is another way of saying perimeter of a circle or ellipse. Circumference comes from the Latin word circumferens which means to carry around, in this case carrying a measurement around the perimeter of a circle or ellipse.
The formula for circumference of a circle is given as:
C = 2πr
C = πd
Where C is the circumference, r is the radius of the circle, and d is the diameter of the circle. For an in-depth look at circumference, see our lesson Perimeter of a Circle.
Hand Calculating the Circumference
The circumference of a circle can easily be calculated by hand with the formulas given above. We may rearrange the formulas to solve for other parameters of the circle as well.
Let’s go through an example together where we must find the circumference.
Find the circumference of a circle with a radius of 13 units.
1.) We can immediately plug the radius into the circumference formula C = 2πr.
2.) C = 2π(13) = 26π = 81.681
3.) The circumference of the circle is 81.681.
How the Calculator Works
The code utilizes the exact same circumference formula as given above. When it detects diameter as the input unit, it converts the size to radius. If radius is already the selected unit, it skips this step and moves forward to the computation.
For the computation, the radius value is plugged into the formula which then outputs the circumference. That answer is rounded to the 4th decimal place and displayed in the answer area. If no valid positive number input is detected, it simply does not perform any calculation.