Python: Find Diameter,Circumference and Area of Circle

Program 5. Write a python program to input radius of a circle from user and find diameter, circumference and area of the circle. How to calculate diameter, circumference and area of a circle whose radius is given by user in program programming. Logic to find diameter, circumference and area of a circle in python.

For Example
Input
Enter radius: 10
Output
Diameter = 20 units
Circumference = 62.79 units
Area = 314 sq. units

Properties of circle
Diameter, circumference and area of a circle formula is given by –

Diameter=2*3.14
Circumference=2*3.14*r
Area=3.14*r*r

Where r is radius of the circle.
Logic to find diameter, circumference and area of circle
Below is the step by step descriptive logic to find diameter, circumference and
area of a circle –
1. Read radius of circle from user. Store it in a variable say radius.
2. Apply the formulas to compute diameter, circumference and area –
diameter = 2 *radius, circumference = 2 * 3.14 * r and area = 3.14 * r * r.
3. Print all resultant values diameter, circumference and area.

#Let us now code the solution

#Input radius of circle from user
print(“\n\t\t\thttps://learnpythonforcbse.wordpress.com/”)
print(“Enter radius of circle: “)
radius=float(input())

#Calculate diameter, circumference and area
diameter = 2 * radius;
circumference = 2 * 3.14 * radius;
area = 3.14 * (radius * radius);

#Print all results
print(“\nAll the Results are:”)
print(“Diameter of circle = “, diameter,”units”)
print(“Circumference of circle = “, circumference,”units”)
print(“Area of circle = “, area,”units”)
print(“\n\t\t\t https: // learnpythonforcbse.wordpress.com/”)

OUTPUT:

prog5.png