Python
Write a program that accepts the radius of a circle and prints its area.
Answers
Answered by
6
The given problem is solved using language - Python.
from math import pi
r=float(input('Enter the radius of the circle: '))
a=round(pi*r*r,2)
print('Area of the circle is:',a,'square unit.')
- Line 1: Imports the value of pi from math module so as to calculate the area of the circl.e
- Line 2: Accepts the radius of the circle as input.
- Line 3: Calculate the area of the circle using formula and round it off to two digits.
- Line 4: Displays the area of the circle.
#1
Enter the radius of the circle: 20
Area of the circle is: 1256.64 square unit.
————————————————————————
#2
Enter the radius of the circle: 10
Area of the circle is: 314.16 square unit.
Attachments:
Similar questions
India Languages,
15 days ago
Science,
1 month ago
Hindi,
1 month ago
Math,
9 months ago
English,
9 months ago