2021-11-10 计算圆的周长和面积

一,计算圆的周长和面积

要求:结果保留两位小数

在这里插入图片描述

运行程序,查看结果

在这里插入图片描述

import math
#输入部分
r = float(input(‘圆的半径= ‘))
#处理部分
c = 2 * math.pi * r
s = math.pi* r**2
#输出部分
print(‘圆的周长={}’.format(’%.2f’ %c))
print(‘圆的面积={}’.format(’%.2f’ %s)

猜你喜欢

转载自blog.csdn.net/Pythonwudud/article/details/121254895
今日推荐