一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
**输出格式要求:"the total of road is %f\n" "the tenth is %f meter\n"
#include<stdio.h>
int main()
{
double s=100,h=s/2;
int n;
for(n=2;n<=10;n++)
{
s=s+2*h;
h=h/2;
}
printf("the total of road is %f\n",s);
printf("the tenth is %f meter\n",h);
return 0;
}