#include <iostream> #include <cmath> using namespace std; int main() { cout << "Please enter R: "; double R; cin >> R; cout << "Please enter x: "; double x; cin >> x; cout << "Please enter i: "; double i; cin >> i; cout << "Please enter n: "; double n; cin >> n; double B = R * (1 - (x + 1) * pow(1 + i, -(n - x))) / (2 * i - 1); // (a) //double B = R * ((1 - (x + 1) * pow((1 + i), -(n - x))) / (2 * i - 1)); // (b) //double B = R * (1 - (x + 1) * pow(1 + i, -n + x)) / (2 * i - 1); // (c) cout << B << endl; return 0; }