Skip to content

Instantly share code, notes, and snippets.

@bploeckelman
Created September 3, 2012 23:03
Show Gist options
  • Save bploeckelman/3614498 to your computer and use it in GitHub Desktop.
Save bploeckelman/3614498 to your computer and use it in GitHub Desktop.
Ex2. Dynamic BasicBlock Count - test program 2
#include <stdio.h>
int fib(int x)
{
if (x < 0 ) return 0;
if (x == 0 || x == 1)
return x;
else
return fib(x - 1) + fib(x - 2);
}
int main()
{
printf("Enter a positive integer: ");
int x = 0;
scanf("%d", &x);
printf("\nfib(%d) = %d\n", x, fib(x));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment