T:一个球从 100 米高的自由落下,每次落地后反跳回原高度的一半,再落下,再反弹。求第
10次落地时,共经过多少米,第 10 次反弹多高。
#include <stdio.h>
int main()
{
double high = 100.0;
double total = 0.0;
int n = 10;
int i = 0;
total += high;
for (i = 0; i < 9; i++)
{
high /= 2;
total += high * 2;
}
printf("total = %lf\n", total);
printf("high = %lf\n", high / 2);
system("pause");
return 0;
}
转载于:https://blog.51cto.com/10707460/1753152