/*【程序10】 题目:一球从100米高度*落下,每次落地后反跳回原高度的一半;再落下,求它在 第10次落地时,共经过多少米?第10次反弹多高? */ package test; public class test { public static void main(String[] args) { // TODO Auto-generated method stub double high = 100.0; double jump = 0.0; double sum = 0.0; for(int i = 0; i < 10; i++) { jump = high / 2; sum = sum + jump; high = jump; System.out.println(sum+","+jump); } } }
50.0,50.0 75.0,25.0 87.5,12.5 93.75,6.25 96.875,3.125 98.4375,1.5625 99.21875,0.78125 99.609375,0.390625 99.8046875,0.1953125 99.90234375,0.09765625
纳尼,这个好简单有木有???