Write a program that calculates the circumference and area ofa Sem radius.
时间: 2024-02-17 12:00:59 浏览: 96
New-folder-(2).rar_The Program
Sure, here's a Python program that calculates the circumference and area of a circle with a given radius:
```python
import math
radius = float(input("Enter the radius of the circle: "))
circumference = 2 * math.pi * radius
area = math.pi * radius ** 2
print("The circumference is:", circumference)
print("The area is:", area)
```
In this program, we first prompt the user to enter the radius of the circle. We then use the math module to calculate the circumference and area of the circle, using the formulas:
- Circumference = 2 * pi * radius
- Area = pi * radius^2
Finally, we print out the results to the user.
阅读全文