Area of a circle
The area of a circle is the number of square units within the circle. To calculate the area of a circle the standard formula is: Area = Pi R Square
Area of circle = (A = πr²)
Logic
Here we have taken radius as input from the user, and to calculate the area of the circle we have to multiply the value of pi with the square of the radius.
Value of Pi = (3.14159)
Program
# Take radius from user radius = float(input("Enter radius of the circle : ")) # Calculate area area = 3.14 * (radius * radius) # Print the result print("\nArea of circle :", area)
Output
Enter radius of the circle : 25.125
Area of circle : 1982.1740625
Know more about Pi? – What is Pi?