Coding Through the Alphabet - Fibonacci in C
C is a general-purpose, procedural programming language. It is one of the most widely used languages in systems programming.
How to test
Prerequisites: GCC (install with sudo apt install gcc or brew install gcc)
gcc fibonacci.c -o fibonacci && ./fibonacci
Expected output:
0
1
1
2
3
5
8
13
21
34
Source Code
#include <stdio.h>
int main(void) {
int a = 0, b = 1, c;
for (int i = 0; i < 10; i++) {
printf("%d\n", a);
c = a + b;
a = b;
b = c;
}
return 0;
}
Local Testing Screenshot
