Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write, compile, and execute a C program that calculates and displays the amount

ID: 3659960 • Letter: W

Question

Write, compile, and execute a C program that calculates and displays the amount of money, A, available in N years when an initial deposit of X dollars is deposited in a bank account paying an annual interest rate of R percent. Use the relationship that A = X(1.0 + R/100)^N. The program should prompt the user to enter appropriate values and use scanf() statements to accept the data. In constructing your prompts, use strings such as Enter the amount of the initial deposit. Verify the operation of your program by calculating, by hand, and using your program, the amount of money available for the following test cases: Test data set 1: $1000 invested for 10 years at 0% interest Test data set 2: $1000 invested for 10 years at 6% interest When you have completed your verification, use your program to determine the amount of money available for the following cases: a. $1000 invested for 10 years at 8% interest. b. $1000 invested for 10 years at 10% interest. c. $1000 invested for 10 years at 12% interest. d. $5000 invested for 15 years at 8% interest. e. $5000 invested for 15 years at 10% interest. f. $5000 invested for 15 years at 12% interest. g. $24 invested for 300 years at 4% interest.

Explanation / Answer

int main()

{

float initial, years, interest, total;

printf(" Enter the initial amount: ");
scanf("%f", &initial);

printf(" Enter the number of years: ");
scanf("%f", &years);

printf(" Enter the interest rate: ");
scanf("%f", &interest);


total = initial * pow(1.0+(interest/100), years); /* changed Total to total, and used the pow function.*/

printf("The total is %f ",total);

}