代码如下:
//计算半径为1.5的圆的周长和面积并输出
#include<stdio.h>
#define PI 3.1415926
int main(void)
{
float radius,length,area;
radius = 1.5;
length = 2*PI*radius; //计算圆的周长
area = PI*radius*radius; //计算圆的面积
printf("radius= %f\n",radius); //输出圆的半径
printf("length= %7.2f, area= %7.2f\n",length,area); //输出圆的周长和面积
return 0;
}
结果如下:
标签:1.5,周长,area,C语言,length,radius,PI From: https://blog.csdn.net/LULU_lulu666/article/details/137019342