#
# fib.jako
#
# Adapted from fibo.pasm by lars@kultunaut.dk.
#
# Copyright (C) 2001-2003 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as the Parrot interpreter.
#
# $Id: fib.jako,v 1.4 2003/07/03 15:32:25 gregor Exp $
#

use sys;

const int n = 24;

var   int a =  1;
var   int b =  1;
var   int f =  1; 
var   int i =  3;

sys::print("Algorithm F2 (Fibonacci's function)\n");
sys::print("  Calculating fib($n) = ...\n");

while (i <= n) {
  f = a + b;
  a = b;
  b = f;
  i++;
}

sys::print("  ... = $f\n");

