Present value is the value today of a future (or past) payment or stream of payments. Or understood as: When the value of costs or benefits is measured in today's cash
The idea of this question is to convert future expenditure and income into today's present value to calculate the profit and loss of the project
code show as below
#include<iostream>#include<cstdio>#include<cmath>usingnamespace std;intmain(){
int n;double i;
cin >> n >> i;double res;
cin >> res;for(int j =1; j <= n;++j){
double x;
cin >> x;
res += x *pow(1+ i,-j);}printf("%.3lf\n", res);return0;}