/*************************************************** Compound Interest (Version 1) Write a program that reads an annual interest rate from the user, and computes the ammount of money you'd have after 10 years at that interest rate, if you made $100.00 payments into the account at the beginning of each year. The formula for interest is this: If T is the amount of money in your account at the beginning of the year, and r is the annual interest rate, the amount in your account at the end of the year is: T*(1.0 + r/100.0) ***************************************************/ #include <iostream> using namespace std; int main() { // Read interest rate double r; cout << "Enter interest rate: "; cin >> r; // Compund 10x - Ti is the amount of money in // your account after year i is finished. double T1,T2,T3,T4,T5,T6,T7,T8,T9,T10; T1 = 100.0*(1.0 + r/100.0); T2 = (T1 + 100.0)*(1.0 + r/100.0); T3 = (T2 + 100.0)*(1.0 + r/100.0); T4 = (T3 + 100.0)*(1.0 + r/100.0); T5 = (T4 + 100.0)*(1.0 + r/100.0); T6 = (T5 + 100.0)*(1.0 + r/100.0); T7 = (T6 + 100.0)*(1.0 + r/100.0); T8 = (T7 + 100.0)*(1.0 + r/100.0); T9 = (T8 + 100.0)*(1.0 + r/100.0); T10 = (T9 + 100.0)*(1.0 + r/100.0); // Write results. cout << "Final amount is: " << T10 << " dollars" << endl; return 0; }