[CD] Write a program that reads in the radius of a circle and prints the circle’s diameter, cir- cumference and area. Use the constant value 3.14159 for ?. Do these calculations in output state- ments.

What will be an ideal response?

```
# Given the radius of a circle, output its diameter,
# circumference and area.

# obtain user-entered radius
radius = raw_input( "Enter the circle's radius: " )
radius = float( radius )

pi = 3.14159 # use 3.14159 for pi

# calculate and print the circle's diameter
print "Diameter is", ( 2 * radius )

# calculate and print the circle's circumference
print "Circumference is", ( 2 * pi * radius )

# calculate and print the circle's area
print "Area is", ( pi * radius ** 2 )
```
Enter the circle's radius: 8
Diameter is 16.0
Circumference is 50.26544
Area is 201.06176

Computer Science & Information Technology

You might also like to view...

Which technology would support talking to a friend in Europe over the Internet?

A) VoIP B) PSTN C) QoS D) Convergence

Computer Science & Information Technology

For the graph signal shown in Figure 9.4, compute the gradient vectors at each node. What is the total variation of the graph signal?

What will be an ideal response?

Computer Science & Information Technology