Python Program to Find Area and Circumference of Circle

Program to find area and circumference of circle using radius in python; Through this tutorial, i am going to show you how to find area and circumference of circle using radius in python.

There mathematical formula to find or calculate area and circumference of circle using radius:

  1. Diameter of a Circle = 2r = 2 * radius
  2. Area of a circle is: A = πr² =  π * radius * radius
  3. Circumference of a Circle = 2πr = 2 * π * radius

Python Program to Find Area and Circumference of Circle

See the following python programs to find or calculate the area and circumference of circle; as shown below:

  • Python Program to find Diameter Circumference and Area Of a Circle
  • Python Program to Calculate Diameter Circumference and Area Of a Circle using Function

Python Program to find Diameter Circumference and Area Of a Circle

  • Get input the radius of a circle from user in program.
  • Using the radius value and formula to calculate the Circumference, Diameter, and Area Of a Circle,
    • Diameter of a Circle = 2r = 2 * radius,
    • Area of a circle are: A = πr² =  π * radius * radius
    • Circumference of a Circle = 2πr = 2 * π * radius.
  • Print Area and Circumference of Circle.
# Python Program to find Diameter, Circumference, and Area Of a Circle
PI = 3.14
radius = float(input(' Please Enter the radius of a circle: '))
diameter = 2 * radius
circumference = 2 * PI * radius
area = PI * radius * radius
print(" \nDiameter Of a Circle = %.2f" %diameter)
print(" Circumference Of a Circle = %.2f" %circumference)
print(" Area Of a Circle = %.2f" %area)

After executing the python program, the output will be:

Please Enter the radius of a circle:  5
 
Diameter Of a Circle = 10.00
Circumference Of a Circle = 31.40
Area Of a Circle = 78.50

Python Program to Calculate Diameter Circumference and Area Of a Circle using Function

  • Create functions to calculate the Circumference, Diameter, and Area Of a Circle in program.
  • Get input the radius of a circle from user in program.
  • Print Area and Circumference of Circle.
# Python Program to find Diameter, Circumference, and Area Of a Circle
import math
def find_Diameter(radius):
    return 2 * radius
def find_Circumference(radius):
    return 2 * math.pi * radius
def find_Area(radius):
    return math.pi * radius * radius
r = float(input(' Please Enter the radius of a circle: '))
diameter = find_Diameter(r)
circumference = find_Circumference(r)
area = find_Area(r)
print("\n Diameter Of a Circle = %.2f" %diameter)
print(" Circumference Of a Circle = %.2f" %circumference)
print(" Area Of a Circle = %.2f" %area)

After executing the python program, the output will be:

 Please Enter the radius of a circle:  56

 Diameter Of a Circle = 112.00
 Circumference Of a Circle = 351.86
 Area Of a Circle = 9852.03

Recommended Python Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.