一只大象口渴了,要喝20升水才能解渴,但现在只有一个深h厘米,底面半径为r厘米的小圆桶(h和r都是整数)。问大象至少要喝多少桶水才会解渴。(设PAI=3.14159)
提示信息:"please input the height and the radius:\n"
输入格式:"%d,%d"
小圆桶的深h,和底面半径r,单位都是厘米。
输出格式:"%d"
我的做法:
#include<stdio.h>
int main()
{
int h, r, n;
double sum;
double PAI = 3.14159;
printf("please input the height and the radius:\n");
scanf("%d,%d", &h, &r);
n = 1;
while(sum >= 20000)
{
sum = PAIrrhn;
n = n + 1;
}
printf("%d", n);
return 0;
}