Write a program to help the banking industry calculate interests. A customer mak
ID: 2246382 • Letter: W
Question
Write a program to help the banking industry calculate interests.
A customer makes an initial deposit of X dollars. The interest rate is R% annually. Calculate the ending balance of the deposit for N years. Assume interest compounds annually.
Sample output (with input in bold):
Input initial deposit amount: 100
Input interest rate (%): 5
Input number of years: 3
Initial: $100.00
End of Year 1: $105.00
End of Year 2: $110.25
End of Year 3: $115.76
Write a program to help the banking industry calculate interests.
A customer makes an initial deposit of X dollars. The interest rate is R% annually. Calculate the ending balance of the deposit for N years. Assume interest compounds annually.
Sample output (with input in bold):
Input initial deposit amount: 100
Input interest rate (%): 5
Input number of years: 3
Initial: $100.00
End of Year 1: $105.00
End of Year 2: $110.25
End of Year 3: $115.76
Explanation / Answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
float p;// principle amount
float r;// interest rate;
int n;// years
cout<<"enter you initial amounts: ";
cin>>p;
cout<<" Enter interest rate: ";
cin>>r;
cout<<" enter numbers of year: ";
cin>>n;
float res[n],temp;
r=r/100;
for (int i=1;i<=n;i++){
res[i-1]=p*(pow(r+1,i));
}
cout<<" Initial: "<<p<<endl;
for (int i=0;i<n;i++){
cout<<" End of Year "<<i+1<<": "<<res[i]<<endl;
}
}
OUTPUT:
enter you initial amounts: 100
Enter interest rate: 5 enter numbers of year: 3
Initial: 100
End of Year 1: 105
End of Year 2: 110.25
If you like this answer , then please give me rating ,
If you want some other language then also ping me.
End of Year 3: 115.762
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.