Area of Circle Program In Python

Hello everyone, welcome to nkcoderz.com. In this article we will going to discuss about Area of Circle Program In Python.

To calculate the area of a circle in Python, you can use the following formula:

area = pi * r**2

Here, “area” is the variable that will hold the result, “pi” is a constant representing the value of pi (approximately 3.14), and “r” is the radius of the circle. The “**” operator raises the value of “r” to the power of 2.

Reverse A String In Python

Area of Circle Program In Python

To use this formula in a program, you will need to import the math module, which provides mathematical functions, including the value of pi. Here’s an example of how you could use this formula to calculate the area of a circle with a radius of 5:

import math

def area_of_circle(r):
  area = math.pi * r**2
  return area

radius = 5
print(area_of_circle(radius))

Output

78.53981633974483

This code would output the area of the circle with a radius of 5.

Conclusion

If you liked this post, then please share this with your friends and make sure to bookmark this website for more awesome content.


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment