Oo缘来是你oO


posts - 120,comments - 125,trackbacks - 0


public class Fibonacci {

    
private static int MAX = 100;
    
/*
     * print the Fibonacci sequence for values < MAX
     
*/
    
public static void main(String[] args) {
        
int currentVal    = 1;
        
int nextVal        = 1;
        
while(currentVal<MAX){
            System.out.println(currentVal);
            nextVal 
= nextVal + currentVal ;
            currentVal 
= nextVal - currentVal;
        }
    }
}



马嘉楠
jianan.ma@gmail.com

posted on 2007-04-18 16:47 马嘉楠 阅读(426) 评论(0)  编辑  收藏 所属分类: SoureCode

只有注册用户登录后才能发表评论。


网站导航: