diff --git a/fibonacci.c b/fibonacci.c new file mode 100644 index 0000000..adb4802 --- /dev/null +++ b/fibonacci.c @@ -0,0 +1,28 @@ +#include +int main() { + + int i, n; + + int t1 = 0, t2 = 1; + + int next = t1 + t2; + + printf("kol-vo: "); + scanf("%d", &n); + + printf("Fibonaci: %d, %d, ", t1, t2); + + for (i = 3; i <= n; ++i) { + printf("%d, ", next); + t1 = t2; + t2 = next; + next = t1 + t2; + } + + return 0; +} + + + + +