Answer to Question #271944 in C++ for Being Noko

Question #271944

Compound interest is the addition of interest to the principal (original) sum of a loan or deposit, or in



other words, interest on interest. It is the result of reinvesting interest, rather than paying it out, so that



interest in the next period is then earned on the principal sum plus previously-accumulated interest.



The compound interest is calculated using the formula below.




A = P(1 + (r/100))^n




Where:



A = total amount after n year



P = Principal or Original price



r = rate of interest per annum



N = number of years the money is invested







1 Write a program that will calculate the compound interest using the formula above with an annual interest



rate of 5.4 %.

1
Expert's answer
2021-11-26T07:08:47-0500
#include <iostream>
#include <math.h>
using namespace std;


int main()
{
    float P;
    float A,n, r=5.4;


    cout << "Enter the principal amount" << endl;
    cin>>P;
    cout<<"Enter the number of years"<<endl;
    cin>>n;
    A=P*pow((1+r/100),n)-P;
    cout<<"Compound interest is : "<<A<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS