四川最正宗的酸菜品牌:一球从100米高自由落下,每次落地反跳原高度的一半,再落下,求在第10次落地时,共经过多少米?第10次反弹多高

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 18:53:50
请用c 语言来编译这个程序,谢谢!急用!!

程序源代码:
#include "stdio.h"
#include "stdio.h"
main()
{
float sn=100.0,hn=sn/2;
int n;
for(n=2;n<=10;n++)
{
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("the total of road is %f\n",sn);
printf("the tenth is %f meter\n",hn);
getch();
}

最简单的东西了
呵呵