The circle’s circumference — the measure of the total length around the shape — is determined based on the fixed ratio of Pi. In degrees, a circle is equal to 360° and Pi (p) is the fixed ratio equal to 3.14.
Area: p * r * r
Perimeter: 2 * p * r
Python Code:
1 2 3 4 5 6 7 |
r=float(input("Input Radius : ")) area=3.14*r*r perimeter=2*3.14*r print("Area of Circle: ",area) print("Perimeter of Circle: ",perimeter) |
Example 2: With round function
1 2 3 4 5 6 7 |
r=float(input("Input Radius : ")) area=round(3.14*r*r,2) perimeter=round(2*3.14*r,2) print("Area of Circle: ",area) print("Perimeter of Circle: ",perimeter) |
Output:
1 2 3 4 5 |
Input Radius : 17 Area of Circle: 907.46 Perimeter of Circle: 106.76 |
[…] Area and Perimeter of a Circle in Python […]
r=float(input(“input radius : “))
input radius=3
area=3.14*r*r
perimeter=2*3.14
print(“area of circle : “,area)
perimeter of circle=28.259999999999998
print(“perimeter of circle :”,perimeter)
perimeter of circle=56.519999999999996