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
马嘉楠 阅读(441)
评论(0) 编辑 收藏 所属分类:
SoureCode