# Program to find the area and circumference of circle
"""
In this program, we have to calculate the area and circumference of circle
We have the formula,
a= pie*r^2
v=2*pie*r
As we already know the value of pie as 22/7 or 3.1415,
we only have to ask the value of r from the user
"""
r = float(input('enter the radius of circle'));
a= 22/7*r ** 2
v=2*22/7*r
print("The area of circle is", a)
print("The circumference of circle is", v)
"""
If the radius is explicitly given.
Then we do not have to ask the value of r from the user
Let us suppose we have to find the volume of sphere whose radious is r."""
r = 3.2
a= 22/7*r ** 2
v=2*22/7*r
print("The area of circle is", a)
print("The circumference of circle is", v)
"""
We can also do this question by defining value of pie
instead of giving value of pie as 22/7 or 3.1415.
"""
pie=22/7
r = float(input('enter the radius of sphere'));
a= pie*r ** 2
v=2*pie*r
print("The area of circle is", a)
print("The circumference of circle is", v)
"""
We can also do this by using constants.
For that we must define the constants in next module or in seperate file.
Normally in practice, constants are rarely used in Python.
"""
8. Write a program to display area and circumference of circle.
Related Posts
19. Write a program to display total surface area of sphere.(Java, Python, JavaScript, QBasic, C, Go, c++, C#, R)
Algorithm : Step 1: Start Step 2: Input Radius (R) Step 3: A = 4 * 3.14 *…
32. Write a program to display area of triangle.(Java, Python, JavaScript, QBasic, C, Go, c++, C#, R)
Algorithm: Step 1: Start Step 2: Input Breadth and Height. (B, H) Step 3: A = 1/2 *…
40. Write a program to display cost of painting the four walls of a room.(Java, Python, JavaScript, QBasic, C, Go, c++, C#, R)
Algorithm: Step 1: Start Step 2: Enter length, breadth, height and cost (l, b, h, c) Step 3:…