Python Program to Find Area and Circumference of Circle using Radius

Python Program to Find Area and Circumference of Circle using Radius

In this python post, we would love to share with you how to find diameter circumference and area Of a circle.

The mathematical formulas are:

  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

Let’s follow the following algorithm to write a program to calculate the circumference of a circle in python:

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

Python Program to find Diameter Circumference and Area Of a Circle

  • Allow users to input the radius of a circle.
  • Using the radius value, this Python 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 and Circumference of a Circle = 2πr = 2 * π * radius.
  • Print result.
# 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

# 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

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *