Last active
March 14, 2025 18:21
-
-
Save derekmc/60ff447efc977efdd8b7ec8dc4916685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
double fib(int n){ | |
double a = 1; | |
double b = 1; | |
while(--n > 0){ | |
b += a; | |
a = b - a; | |
} | |
return b; | |
} | |
int main(int argc, char *argv[]){ | |
printf("Hello, World!"); | |
int n = 5; | |
double a = fib(n); | |
printf("fib(%d) = %lf", n, a); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment