fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. float principal, rate, time, amount, compoundInterest;
  7.  
  8. cout << "Enter Principal amount: ";
  9. cin >> principal;
  10.  
  11. cout << "Enter Rate of Interest: ";
  12. cin >> rate;
  13.  
  14. cout << "Enter Time (in years): ";
  15. cin >> time;
  16.  
  17. amount = principal * pow((1 + rate / 100), time);
  18. compoundInterest = amount - principal;
  19.  
  20. cout << "Compound Interest = " << compoundInterest;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5316KB
stdin
11000
5
2
stdout
Enter Principal amount: Enter Rate of Interest: Enter Time (in years): Compound Interest = 1127.5