add fibonacci

This commit is contained in:
lucaspalomodevelop 2022-11-02 19:17:54 +01:00
parent 1de13ffb1d
commit be69eb0f29
5 changed files with 25 additions and 1 deletions

View File

@ -26,7 +26,7 @@ void readfile(string file)
cout << line << '\n';
}
myfile.close();
myfile.close();
}
}

View File

@ -0,0 +1,5 @@
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!
Hallo Welt!

BIN
fibonacci/fib Executable file

Binary file not shown.

14
fibonacci/main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include<iostream>
int fib(int n)
{
return n < 2 ? 1 : fib(n-2)+ fib(n-1);
}
int main()
{
std::cout << "Geben sie an die wievielte fib. Zahl sie suchen: ";
int n = 0;
std::cin >> n;
std::cout << "fib(" << n << ") = " << fib(n) << "\n";
}

5
fibonacci/makefile Normal file
View File

@ -0,0 +1,5 @@
dev: compile run
compile:
g++ -o fib main.cpp
run:
./fib