Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 5.29 Peter Minuit Problem
- Deitel & Deitel C++ How to Program, 10th ed (Indian subcontinent adaptation)
- Visual Studio Community 2019
- */
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main() {
- cout << fixed << setprecision(2);
- double principal{ 24.00 }; // initial amount before interest
- cout << "After 395 years:\n\n";
- for (double rate{ 0.05 }; rate <= 0.10; rate += 0.01) {
- double amount = principal * pow(1.0 + rate, 394);
- cout << "Interest rate: " << rate << setw(30) << "$" << amount << "\n\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment