// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class Fib {
   public static void main(String[] args) {
      for (int i = 1; i <= 10; i++) {
         System.out.println(i + " " + fib1(i) + " " + fib2(i));
      }
   }
   public static int fib1(int n) {
      if (n > 2) {
         return (fib1(n - 1) + fib1(n - 2));
      } else {
         return 1;
      }
   }
   public static int fib2(int n) {
      if (n > 2) {
         int[] a = new int[2];
         a[0] = 1;
         a[1] = 1;
            for(int i = 2; i < n; i++) {
                a[i % 2] = a[0] + a[1];
            }
            return a[(n - 1) % 2];
      } else {
         return 1;
      }
   }
}
