Question: (Calculating the Compound Interest with Integers) Modify the program of Fig. 4.6 so that it uses only integers to calculate the compound interest. [Hint: Treat

(Calculating the Compound Interest with Integers) Modify the program of Fig. 4.6 so that it uses only integers to calculate the compound interest. [Hint: Treat all monetary amounts as integral numbers of pennies. Then break the result into its dollar portion and cents portion by using the division and remainder operations, respectively. Insert a period.]

(Calculating the Compound Interest with Integers) Modify the program of Fig. 4.6

Modify Problem 4.23 from your text such as

Once you run the program it will prompt you for

Please input the principle amount in dollars and cent such as 10000 means $100.00

Please enter the interest rate in percent such 5 means .05

Enter the number of years.

Once you enter the last value, it would give similar list to the result in the book

I / Fig. 4.6:fig04_06.c ing compound interest 3 #include 6 int mainCvoid) double principal1000.0 // starting principal double rate = 05; // annual interest rate 10 // output table column heads printf("%45%21s " " "Year". "Amount 12 deposit"); on Fig. 4.6 | Calculating compound interest. (Part I of 2.) 122 Chapter 4 C Program Control 13 calculate amount on deposit for each of ten years for (unsigned int year-1; year 10: ++year) { 15 16 17 18 19 20 21 // calculate new amount for specified year double amount -principal powC1.0 rate, year): // output one table row printf("%Au%21.2f " " year . amount); 23 Year Amount on deposit 1050.00 1102.50 1157.63 1215.51 1276.28 1340.10 1407.10 1477.46 1551.33 1628.89 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!