Computer Science, asked by phdbsnd, 1 month ago

Python

Write a program that accepts the radius of a circle and prints its area.

Answers

Answered by anindyaadhikari13
6

\textsf{\large{\underline{Solution}:}}

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.')

\textsf{\large{\underline{Explanation}:}}

  • 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.

\textsf{\large{\underline{Sample I/O}:}}

#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