### Area Of a Circle

The area of a circle is number of square units inside the circle. Standard formula to calculate the area of a circle is: A=πr². In this article we will show you, How to write python program to find area of circle using radius, circumstance and diameter

## Python Program to find Area Of Circle using Radius

If we know the radius then we can calculate the area of a circle using formula: A=πr² (Here A is the area of the circle and r is radius).

**PYTHON CODE**

1 2 3 4 5 6 7 8 9 |
# Python Program to find Area Of Circle using Radius PI = 3.14 radius = float(input(' Please Enter the radius of a circle: ')) area = PI * radius * radius circumference = 2 * PI * radius print(" Area Of a Circle = %.2f" %area) print(" Circumference Of a Circle = %.2f" %circumference) |

**ANALYSIS: **We defined pi as global variable and assigned value as 3.14. This program allows user to enter the value of a radius and then it will calculate the area of circle as per the formula.

**OUTPUT**

## Python Program to find Area Of Circle using Circumference

Distance around the circle is called as circumference. If you know the circumference then we can calculate the area of a circle using formula: A= C²⁄ 4π (Here C is circumference)

**PYTHON CODE**

1 2 3 4 5 6 7 8 |
# Python Program to find Area Of Circle using Circumference import math circumference = float(input(' Please Enter the Circumference of a circle: ')) area = (circumference * circumference)/(4 * math.pi) print(" Area Of a Circle = %.2f" %area) |

**ANALYSIS: **

First, We imported the math library and this supports us to use all the mathematical functions in Python programming. In this example we can call the PI value using **math.pi**

1 |
import math |

Next line of code allows user to enter the value of a circumference.

1 |
circumference = float(input(' Please Enter the Circumference of a circle: ')) |

Using the circumference, this program will calculate the area of circle as per the formula: A= C²⁄ 4π

**OUTPUT**

## Python Program to Calculate Area Of a Circle using Diameter

Distance across the circle passing through the center is called as diameter. If we know the diameter then we can calculate the area of a circle using formula: A=π/4*D² (D is the diameter)

**PYTHON CODE**

1 2 3 4 5 6 7 8 9 10 11 12 13 |
# Python Program to find Area Of Circle using Diameter import math diameter = float(input(' Please Enter the Diameter of a circle: ')) area1 = (math.pi/4) * (diameter * diameter) # diameter = 2 * radius # radius = diameter/2 radius = diameter / 2 area2 = math.pi * radius * radius print(" Area of Circle using direct formula = %.2f" %area1); print(" Area of Circle Using Method 2 = %.2f" %area2) |

**ANALYSIS: **This program allows user to enter the value of a diameter and then it will calculate the area of circle as per the formula we shown above.

We also mentioned other approach.

diameter = 2 * radius

radius = diameter/2

area = π * radius * radius

**OUTPUT**

Thank You for Visiting Our Blog

RealGDRobin says

i used (everything between the 000's:

0000000000000000000000000000000000000000000000000000000000

import math

diameter = int(input('Please Enter the Diameter of a circle: '))

area1 = (math.pi/4) * (diameter * diameter)

print("Area of Circle using direct formula = %.2f" %area1);

choice = input("Press ANY KEY to finish")

000000000000000000000000000000000000000000000000000000000000

"choice/i" so it won't crash after the awnser 🙂

and used just the area so only one will show, just delete some code!

then learn from what you got and do even cooler things with python!

SSSSSSSSSSSSSSSSSSSSSSSSSSS