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