一球从100米高度落下,每次落地后反弹回原来高度的一半,再落下。求它在第10次落地时,共经过多少米?第十次反弹多高?
#include <stdio.h>
#include <math.h>
int main()
{
int i,t=0,n,s,e;
for(i=0;i<10;i++)
{
n=100*pow(0.5,i);
e=2*n;
t+=e;
}
s=t-100-200*pow(0.5,10);
printf("%d%d\n",s,n);
system("pause");
return 0;
}
|