diff options
feat(Week13): Add solutions to most exercises
1 files changed, 19 insertions, 0 deletions
| -rw-r--r-- | Week13/Exercise15.cpp | 19 |
diff --git a/Week13/Exercise15.cpp b/Week13/Exercise15.cpp new file mode 100644 index 0000000..17f75f6 --- /dev/null +++ b/Week13/Exercise15.cpp @@ -0,0 +1,19 @@ +#include <iostream> +#include <cmath> + +double eccentricAnomaly(double M, double e, unsigned depth) { + if (depth == 0) + return M; + return M + e * sin(eccentricAnomaly(M, e, depth - 1)); +} + +int main() +{ + double M, e; + unsigned depth; + std::cin >> M >> e >> depth; + + std::cout << eccentricAnomaly(M, e, depth) << std::endl; + + return 0; +} |
