Write a program to compute future investment value at a given interest rate for a specified number of years.the future investment is determined using the formula:
Futureinverstmentvalue=inverstmentamount *(1+ monthly interest rate)^(years*12)
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double future(double amount, double rate, int year){
double invest = amount*(pow(1+rate, 12*year));
return invest;
}
int main()
{
double invest = future(2000, 0.3, 4);
cout << "Future investment value: ";
printf("%.5f\n", invest);
return 0;
}
Output:
Future investment value: 589265352.63802
Comments
Leave a comment