有一分數序列:2/1,3/2,5/3,8/5,13/8,21/13... 求出這個數列的前 20 項之和

  public class Guo04 { public static void main(String[] args) { double sum = 0, a = 2, b = 1, c = 0; for(double i = 1; i <= 20; i++) { sum = sum + a/b; c = a; a = a + b; b = c; }
相關文章
相關標籤/搜索