Let us write a small program today to print the area of circle in Python. The program will accept user input in the form of radius of the circle. There is a constant pi whose value we will be set to 3.142
Code :
print ('Program to calculate area of circle \n')
pi = 3.142
r = float(input('Enter radius : '))
a = pi*(r**2)
print ('Area of circle :', a )
Output :
Code :
print ('Program to calculate area of circle \n')
pi = 3.142
r = float(input('Enter radius : '))
a = pi*(r**2)
print ('Area of circle :', a )
Output :
OR
No comments:
Post a Comment