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;
}
}
}
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;
}
}
}