菜鸟涂鸦作品展

it2022-06-23  83

//【程序10】题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;//再落下,求它在 第10次落地时,共经过多少米?第10次反弹多高?public class _10_tanqiu { double tan(double length){ return length/2; } public static void main(String[] args){ double length=100; int n=10; _10_tanqiu tq=new _10_tanqiu(); for (int i=1; i<=n; i++){ length=tq.tan(length); System.out.println("第"+i+"次弹起的高度为"+length); } }}

 

涂鸦心得:

  以前编过这个,就简单写一下吧。。。

转载于:https://www.cnblogs.com/aniuer/archive/2012/08/26/2657697.html


最新回复(0)