Monday, 24 January 2022

Write a python program to create a class Circle and Compute the Area and the circumferences of the circle.(use parameterized constructor)

Slip 20 Q 1

CODE :

from math import pi
class Circle():
    def __init__(self,Radius):
        self.Radius=Radius
    def area(self):
        a=pi*self.Radius*self.Radius      
        return round(a,2)
    def circumference(self):
        c=2*self.Radius*pi
        return round(c,2)
   
r= int(input('enter radius of circle : '))
a=Circle(r)
print('Area of circle is : ',a.area())
print('Circumference of circle is : ',a.circumference())


OUTPUT:



No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...