How to Calculating the area of a circle using Python:-
The area of the circle is the number of square units inside the circle, can be calculated using the radius and diameter. The formula for evaluating the area of a circle is
- Area of circle using radius= Pi*r*r ( r is the radius of the circle)
- Area of the circle using diameter= 1/4*Pi*d*d ( d is the diameter of the circle)
Pi is a Greek letter and the value of Pi is equal to 3.14159265359. In the program, we will be initiating Pi as a global variable or we can simply import from the math module present in python. The syntax for importing pi from math module: from import math.
ALGORITHMS:-
1.Input radius/diameter.
2.Calculate the area of a circle using the formula.
area= pi*r*r(if radius is given as input).
area=(pi*d*d)/4 (if diameter is given as input).
3.Print area.
CODE: -
radius= int(input("Enter radius of the circle:\n"))area=3.14*radius**2print("Area of circle:{0:.2f}".format(area))
💬💬💬💬💗💗💗💗
Comments
Post a Comment