Commit 45c3d5a1 authored by Alexander Hirsch's avatar Alexander Hirsch
Browse files

Add fib example

parent 016929a4
int fib(int n)
{
if (n < 2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
int main()
{
print("Please enter a number: ");
int n;
n = read_int();
print_nl();
int result;
result = fib(n);
print("fib(");
print_int(n);
print(") = ");
print_int(result);
print_nl();
return 0;
}
Please enter a number:
fib(11) = 89
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment