Develop a C++ Application for Compound Interest Calculations. A person invests $1000.00 in a savings account yielding 5 percent interest. Assuming that all interest is left on deposit in the account, calculate and print the amount of money in the account at the end of each year for 10 years. Use the following formula for determining these amounts: a = p ( 1 + r )n where p is the original amount invested (i.e., the principal), r is the annual interest rate, n is the number of years and a is the amount on deposit at the end of the n th year.
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double p = 1000.00;
double rate = 0.05;
double n = 10;
double amount = p * pow((1 + rate ), n);
cout<<"Amount is: "<<amount<<endl;
}
Comments
Leave a comment