Computer Science, asked by gourisweet4560027, 1 year ago

write a program that accepts radius of a circle and prints area and perimeter​

Answers

Answered by Zisha7
0

Answer:

Area of a Circle is givem by:

\sf Area = \pi\times radius^2Area=π×radius

2

So we have to take an input of the value of radius, compute the value of area and print it accordingly.

We need the value of \piπ too. We can set its value as 22/7 or 3.1416 approximately.

Or we can use the pi available in the math module.

Here is a sample program which accomplishes the task:

#Program to calculate Area of Circle

from math import pi

#Or we can set pi=3.1416 approximately

radius = float(input("Enter the radius: "))

area=pi*radius*radius

print("Area of the circle is",format(area,'.3f'),"sq units")

The format command with '.3f' rounds off the value of area to three decimal places.

Similar questions