Question

C Programming: Create code that will allow the user to input their initial investment, their monthly...

C Programming:

Create code that will allow the user to input their initial investment, their monthly deposit into their investment, the annual interest rate, and the years to calculate your monthly investment.

The table should have three columns: (1) the month (starting at zero), (2) the total amount invested that month, and (3)the present value of your investment with compound interest at the end of that month.

(YOU CANNOT USE THE POW FUNCTION)

I'm having serious difficulty formulating a loop that gives me the correct amount, it's definitely my equations. PLEASE HELP!!!

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int main()
{
    double balance, rate, deposit, investment;
    int years, i;
    printf("Enter initial investment: ");
    scanf("%lf", &balance);
    printf("Enter annual interest rate: ");
    scanf("%lf", &rate);
    printf("Enter monthly deposit: ");
    scanf("%lf", &deposit);
    printf("Enter number of years: ");
    scanf("%d", &years);
    rate /= 12;
    rate /= 100;
    investment = balance;
    for(i = 0; i < 12*years; ++i) {
       balance += (rate * balance);
       balance += deposit;
       printf("%d\t%lf\t%lf\n", (i+1), investment+((i+1)*deposit), balance);
   }
    return 0;
}

Enter initial inuestment 1000 Enter annual interest rate: 15 9 Enter monthly deposit: 100 Enter number of years: 3 1100.00000

Add a comment
Know the answer?
Add Answer to:
C Programming: Create code that will allow the user to input their initial investment, their monthly...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write C++ program for a compound interest calculator. Ask the user for dep = initial deposit...

    Write C++ program for a compound interest calculator. Ask the user for dep = initial deposit r = interest rate expressed as a fraction (example: .06) t = years If we assume that the money is compounded on a monthly basis, the formula is: double final = dep * pow( 1 + r/12.0 , 12.0*t ); Then display the final amount. To earn full credit, comment your code well. Supposedly, with a deposit of 1000, and 5% interest (0.05), for...

  • Project 9-2: Account Balance Calculator Create an application that calculates and displays the starting and ending...

    Project 9-2: Account Balance Calculator Create an application that calculates and displays the starting and ending monthly balances for a checking account and a savings account. --->Console Welcome to the Account application Starting Balances Checking: $1,000.00 Savings:  $1,000.00 Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 500 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): s Amount?: 200 Continue? (y/n): n Monthly Payments and Fees Checking fee:              $1.00 Savings...

  • I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instruction...

    I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...

  • The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use...

    The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use the following libraries: #include <math.h> #include <stdlib.h> #include <string.h> #include <limits.h> and any .graphics and .timers libraries. The guidelines are outlined as follows: Terminal Set-up: you may assume that the terminal will be quite large, for example, on the order of 150×50, or more. Status Display: The...

  • this is all the information given Personal Financial Planning Mini-Case Jeff and Mary Douglas, a couple...

    this is all the information given Personal Financial Planning Mini-Case Jeff and Mary Douglas, a couple in their mid-30s, have two children - Paul age 6 and Marcy age 7. The Douglas' do not have substantial assets and have not yet reached their peak earning years. Jeff is a general manager of a jewelry manufacturer in Providence, RI while Mary teaches at the local elementary school in the town of Tiverton, RI. The family needs both incomes to meet their...

  • Caterpillar Inc. 2017 2016 5 S 51,822 2,900 54,722 42,676 2,786 45,462 35,773 2,764 38,537 STATEMENT...

    Caterpillar Inc. 2017 2016 5 S 51,822 2,900 54,722 42,676 2,786 45,462 35,773 2,764 38,537 STATEMENT 1 Consolidated Results of Operations for the Years Ended December 31 Dollar is willions cat pershare dal Sales and revenues Sales of Machinery, Energy & Transportation Revenues of Financial Products Total sales and revenues Operating costs Cost of goods sold Selling, general and administrative expenses Research and development expenses Interest expense of Financial Products Goodwill impairment charge Other operating incomel expenses Total operating costs...

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT