The following PL/0 program is fib.0 .
module main; var result:int; procedure fib(arg:int); var temp:int; begin if arg <= 0 then result := 0; end; if arg = 1 then result := 1; end; if arg > 1 then fib(arg - 1); temp := result; fib(arg - 2); result := result + temp; end; end fib; var n:int; begin n := input; while n <> 0 do fib(n); output := result; n := input; end; end main. |
cse401-webmaster@cs.washington.edu (Last modified: 10/03/99)