This is a simple program, compiled with Sun's javac, no optimisation.
Here is the original Java source code:
import java.lang.*;
class Fibo {
private static int fib (int x) {
if (x > 1)
return (fib(x - 1) + fib(x - 2));
else return (x);
}
public static void main(String args[]) throws Exception {
int number = 0, value;
try {
number = Integer.parseInt(args[0]);
} catch (Exception e) {
System.out.println ("Input error");
System.exit (1);
}
value = fib(number);
System.out.println ("fibonacci(" + number + ") = " + value);
}
}
You use the program like this:
% java Fibo 10
fibonacci(10) = 55
% java Fibo abc
Input error
%
The corresponding C# source code (for .NET decompiler tests) is in
DecompilerFiboDotNetSource.
--
MikeVanEmmerik - 13 Feb 2003