Created
March 4, 2023 18:41
-
-
Save dcampos/da72832d4c414381e0463ab369c527e6 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> | |
| int fib(int n) { | |
| switch (n) { | |
| case 0: | |
| return 0; | |
| break; | |
| case 1: | |
| return 1; | |
| break; | |
| default: | |
| return fib(n -1) + fib(n -2); | |
| } | |
| } | |
| int main() { | |
| for (int i = 0; i < 10; i++) { | |
| printf("%d\n", fib(i)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment