Javatpoint Logo
Javatpoint Logo

How to Calculate the Area of the Circle using Python

In this tutorial, we will show how the user can calculate the area of the circle by using Python with the given radius of the circle.

To understand the format of the input-output of the code, the user must pay attention the following:

INPUT FORMAT:

The input of the code consists of the integer "R", which represents the radius of the circle.

OUTPUT FORMAT:

The output of the code will print the area of the circle.

Algorithm for Calculating the Area of the Given Circle

Following are the steps we will use for calculating the area of the given circle:

  • Step 1: We have to pass the input using the input() function. The input will be corresponding to the radius of the given circle.
  • Step 2: The Area of the circle will be calculated by using the formula of the Area = πR2.

Area of Circle = π * R * R.

How to Calculate the Area of the Circle using Python

Where, π (PI) = 3.14

R = Radius of circle.

D or (2R) = Diameter of Circle, (R + R).

  • Step 3: Print the output of the code, that is, the area of the given circle.

Methods for finding the Area of the Given Circle using Python

Method 1: Find the area of the given circle using the math module.

Output:

Please enter the radius of the given circle:  3
 The area of the given circle is:  28.274333882308138

Method 2: Calculate the area of the given circle using π

Output:

Please enter the radius of the given circle:  3
 The area of the given circle is:  28.259999999999998

Method 3: Calculate the area of the given circle by using function

Output:

Please enter the radius of the given circle:  3
 The area of the given circle is:  28.274333882308138

Conclusion

In this tutorial, we have shown three methods for calculating the area of the given circle. To calculate the area of the given circle, the user must know the radius or the diameter of the circle. Among the three methods, the first one is the easiest and most direct method.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA