Description:
Print Fibonacci series up to 10 terms.
Print Fibonacci series up to 10 terms.
C Code
#include <stdio.h>
int main() {
int n = 10, a = 0, b = 1, next;
printf("%d %d ", a, b);
for (int i = 2; i < n; i++) {
next = a + b;
printf("%d ", next);
a = b; b = next;
}
return 0;
}
Expected Output
0 1 1 2 3 5 8 13 21 34