2021/11/26
#include<stdio.h>
#include<math.h>
#define pi 3.14
main()
{
float r, v;
printf("please input the radius of the sphere,system will return its volume:\n");
scanf_s("%f", &r);
v = 4.0 / 3 * pi * pow(r, 3);
printf("%.3f\n", v);
}
这是一个使用C语言编写的简单程序,用户输入球体的半径,程序通过公式4/3πr³计算并输出球体的体积。程序中定义π为3.14,并使用`pow`函数计算立方。
2021/11/26
#include<stdio.h>
#include<math.h>
#define pi 3.14
main()
{
float r, v;
printf("please input the radius of the sphere,system will return its volume:\n");
scanf_s("%f", &r);
v = 4.0 / 3 * pi * pow(r, 3);
printf("%.3f\n", v);
}

被折叠的 条评论
为什么被折叠?