Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FibonacciYahoo3 {
- static int a = 0, b = 1;
- static void next() {
- int temp = a + b;
- a = b;
- b = temp;
- } // next()
- public static void main (String[] args) {
- for (int i = 1; i <= 5; i++) {
- for (int j = 0; j < i; j++) {
- System.out.print(a + " ");
- next();
- } // for j
- System.out.println();
- } // for i
- } // main()
- } // class
Add Comment
Please, Sign In to add comment