Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FibonacciSequence {
- public static void main(String args[]) throws InterruptedException {
- int fib1 = 1, fib2 = 1;
- while (fib1 + fib2 < 1000){
- fib1 = fib1 + fib2;
- System.out.println(fib1);
- Thread.sleep(1000);
- fib2 = fib1 + fib2;
- System.out.println(fib2);
- Thread.sleep(1000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment