Website Summary Files Commits Branches @commit @diff @stats
path: root / Week13 / Exercise15.cpp
blob: 17f75f6f920f6e881ce82e150011e102240bde1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}