关于求圆锥体积的c编程出错了
#include<stdio.h>
#define pi 3.14
void main()
{
float r,h;
float s,v,c;
printf("please input the radius and high:\n");
scanf("%f,%f",&r,&h);
s=pi*r*r;
c=2*pi*r;
v=1/3.0*pi*r*r*h;
printf("面积s=%6.2f,周长c=%6.2f,体积v=%6.2f\n",s,c,v);
return 0;
}
#define pi 3.14
void main()
{
float r,h;
float s,v,c;
printf("please input the radius and high:\n");
scanf("%f,%f",&r,&h);
s=pi*r*r;
c=2*pi*r;
v=1/3.0*pi*r*r*h;
printf("面积s=%6.2f,周长c=%6.2f,体积v=%6.2f\n",s,c,v);
return 0;
}
最后求得体积是一大串负数这是什么原因呢?