Dremendo Tag Line

Calculate area of a circle in Python

input() - Question 13

In this question, we will see how to input the radius of a circle in Python programming using the input() function and find its area. To know more about input() function click on the input() function lesson.

Q13) Write a program in Python to input the radius of a circle and find its area. Area of a circle is πr2. Where r is the radius and the value of π (pie) is 22/7 or 3.142

Formula: area = 3.142 * r * r

Program

r=float(input('Enter radius of a circle '))
a=3.142*r*r
print('Area={:.2f}'.format(a))

Output

Enter radius of a circle 5
Area=78.55
video-poster