// NPV calculation
#include<iostream>
#include<cmath>
#define r 0.12 //12% opportunity cos of capital
usingnamespace std;
int main()
{
//variables declaration
constshort C0=-2000; //initial investment
unsignedshort C1=500; // cash inflow in year 1
unsignedshort C2(225); // cash inflow in year 2
unsignedshort C3=336; // cash inflow in year 3
unsignedshort C4(40); // cash inflow in year 4
float NPV; // NPV=?
// Let s put the formula of NPV for 4 years: NPV=Co + C1/(1+r) + C2/(1+r)^2 + C3/(+r)^3 + C4/(1+r)^4
NPV= C0 + (C1/(1+r)) + (C2/(pow(1+r, 2))) + (C3/(pow(1+r, 3))) + (C4/(pow(1+r, 4)));
cout<<NPV<<'\n';
cin.get();
return 0;
}