输入圆的半径计算并输出圆的周长和面积

程序基本架构题 输入圆的半径计算并输出圆的周长和面积
python 程序题

r = float(input())
pi=3.1416
print("area=", r*r*pi, " round=", r*2*pi)

计算圆的周长和面积需要使用到math库里面的π


import math

r = float(input('请输入圆的半径:'))

L = 2*math.pi*r
S = math.pi*math.pow(r,2)

print('圆的周长为{:.2f},面积为{:.2f}'.format(L,S))

运行结果:

img