Computer Science, asked by prajjwal704, 10 months ago

Write python program to calculate area and perimeter of circle. The radius being the input. 2​

Answers

Answered by djdevmega
5

import math

# Here we make a permimeter function using 2 x PI x R

def permimeter(r):

   return 2*math.pi*r

# Here is the area function using PI x R x R ( or R^2 )

def area(r):

   return math.pi*r*r

# Take the input and convert to integer

radius = int(input("Enter the radius: "))

# Calculate perimeter

myPerimeter = perimeter(radius)

# Calculate area

myArea = area(radius)

# Print the output

print(f"Perimeter: {myPerimeter}\nArea: {myArea}")

Similar questions