+ 2
Calculate the area of circle
3 odpowiedzi
+ 3
1. Using math library import.math
2. Ask user to input circle radius
3. Now u can use area of circle formula
Area of Circle = π * R * R.
0
Firstly, you must know the formula :
Area of Circle = π×r² or π×r×r
*r means radius of the circle
* π (pi) = 3.1426
There are 2 ways to calculate the area of circle in python:
#No. 1:
print(3.1416*(float(input()))**2)
#No. 2 (Recommended):
from math import pi
print(pi*(float(input()))**2)
0
from math import *
def circle_area():
r=int(input("Enter radius of circle"))
area = pi*r**2
print (area)
circle_area()