#include <iostream>
#include <cmath>
using namespace std;
struct money
{
int P;
int F;
double r;
int n;
};
int presentValue(int prevalue, double rate, int year);
void main()
{
money M;
cout << "what is your present value ?" << endl;
cin >> M.F;
cout << "the year you want to save :" << endl;
cin >> M.n;
cout << "the rate :" << endl;
cin >> M.r;
cout << "the money you have to deposit :" << presentValue(M.F, M.r, M.n) << endl;
system("pause");
}
int presentValue(int prevalue, double rate, int year)
{
int p=0;
double s = (1 + rate);
double pp = prevalue / pow(s, year);
p = pp + 1;
return p;
}