请大家看看哪出错啦#include<stdio.h> void main() { float r,R,h,s,S,V; float pi=3.1415926; printf("请
#include<stdio.h>voidmain(){floatr,R,h,s,S,V;floatpi=3.1415926;printf("请输入圆台上底半径r,下底半...
#include<stdio.h>
void main()
{
float r,R,h,s,S,V;
float pi=3.1415926;
printf("请输入圆台上底半径r,下底半径R,高h:");
scanf("%f,%f,%f,&r,&R,&h");
s = r*r*pi;
S = R*R*pi;
V = h*pi*(r*r+R*R+r*R)/3.0;
printf("上底面积为: s=%.2f\n",s);
printf("下底面积为: S=%.2f\n",S);
printf("圆台体积为: V=%.2f\n",V);
} 展开
void main()
{
float r,R,h,s,S,V;
float pi=3.1415926;
printf("请输入圆台上底半径r,下底半径R,高h:");
scanf("%f,%f,%f,&r,&R,&h");
s = r*r*pi;
S = R*R*pi;
V = h*pi*(r*r+R*R+r*R)/3.0;
printf("上底面积为: s=%.2f\n",s);
printf("下底面积为: S=%.2f\n",S);
printf("圆台体积为: V=%.2f\n",V);
} 展开
4个回答
展开全部
错误在注释中,下面是修改好的程序和输出结果#include<stdio.h>
void main()
{
float r,R,h,s,S,V;
float pi=3.1415926f;//定义成float,后面有f
printf("请输入圆台上底半径r,下底半径R,高h:");
scanf("%f,%f,%f",&r,&R,&h);//双引号不能包含&r
s = r*r*pi;
S = R*R*pi;
V = h*pi*(r*r+R*R+r*R)/3.0f;//定义成float,后面有f
printf("上底面积为: s=%.2f\n",s);
printf("下底面积为: S=%.2f\n",S);
printf("圆台体积为: V=%.2f\n",V);
}
请输入圆台上底半径r,下底半径R,高h:2,2,4
上底面积为: s=12.57
下底面积为: S=12.57
圆台体积为: V=50.27
void main()
{
float r,R,h,s,S,V;
float pi=3.1415926f;//定义成float,后面有f
printf("请输入圆台上底半径r,下底半径R,高h:");
scanf("%f,%f,%f",&r,&R,&h);//双引号不能包含&r
s = r*r*pi;
S = R*R*pi;
V = h*pi*(r*r+R*R+r*R)/3.0f;//定义成float,后面有f
printf("上底面积为: s=%.2f\n",s);
printf("下底面积为: S=%.2f\n",S);
printf("圆台体积为: V=%.2f\n",V);
}
请输入圆台上底半径r,下底半径R,高h:2,2,4
上底面积为: s=12.57
下底面积为: S=12.57
圆台体积为: V=50.27
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询