题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13…求出这个数列的前20项之和。
新手上路
代码片
.
public static void main(String[] args) {
double high = 100;
double m=0;
double y;
for(int i = 10; i>0; i--) {
m = m+2*high;
high = high/2;
}
m=m-100;
System.out.println("反弹:"+high+"经过"+m);
}