Calculate and print the area of a circle given its radius

Report a typo

Write a program that uses Python's built-in math module. Your program should read a single float value from input, which represents the radius of a circle. Using the math module's 'pi' constant and the provided radius, your program should calculate and print the area of the circle. The area of a circle is calculated using the formula pi*r^2.

Round the result to show 2 digits after the decimal point.

Sample Input 1:

5

Sample Output 1:

78.54

Sample Input 2:

7.1

Sample Output 2:

158.37
Write a program in Python 3
# First step is to import the math module. The math module contains all mathematical functionalities.
import math

# Read radius from input
radius = float(input())

# Now you can use 'math.pi' and the square of radius to calculate the area of the circle. Write down the formula and print it.
# Remember the formula to calculate area of circle is pi*r^2.'

Create a free account to access the full topic