Question

PROGRAMMING IN C. 1) The first program will compute compounded interest. Suppose you invest $1000.00 at...

PROGRAMMING IN C.

1) The first program will compute compounded interest. Suppose you invest $1000.00 at an interest rate of 2% per year. If the interest is computed at the end of each day, it is added to your account (i.e., the interest is compounded daily). Print what the account value will be at the end of each year for 20 years. Use data type double for money. For 365 days per year (ignore leap year), the daily interest rate is 2%/ 365. Your program should request the following numbers as input from the user with scanf():

-Initial account balance (Start with $1000.00)

-Then run and demonstrate it again with the last 6 digits of your ID# so 876123456 would be: 1234.56)

-The annual interest rate in percent.

-Number of years: run it for at least 10 years.

For a compounding period of 1 (daily), the interest must be computed 365 times and accumulated. For a compounding period of 30 (monthly), the interest would be computed 365/30 or 12 times.Print the amount in the account including accumulated interest for each of 20 years for the following compounding periods if you started with $1,000 dollars:

1. Daily (period 1)

2. Weekly (7)

3. Monthly (30)

4. Quarterly (90)

5. Annually (365)

Use DOUBLE variables for your calculations. Run your program again for daily compounding using FLOAT variables, and note the difference in the results. Output should be formatted in columns, by year number something like this:

Year Daily Weekly Monthly Quarterly Annually

---- ------- ------- ------- --------- --------

0 1000.00 1000.00 1000.00 1000.00 1000.00

1 100x.xx 100x.xx 100x.xx 100x.xx 100x.xx

2 10xx.xx

2) Write a program that asks for numeric input and indicates if the digits from an input value input are even or odd.

Use digits of your ID#.The program should print "odd" if that digit x is odd and "even" if x is even. Test and demonstrate with the digits of your

ID# one per line. Print the digits of your ID, one digit on each line, with the result next to each number like this:

Input your ID: 876123456

n odd/even

-- --------------

8 even

7 odd

6 even

1 odd

2 even

3 odd

...

3) Write a program that indicates if a number input is a prime number or not. The program should repeat this until the user enters 0 to exit. For example, the input of 17 should print "prime", since 17 has no divisors other than 17 and 1 (hence 17 is a prime number). Input of 21 should print "not a prime" (3 and 7 are both divisors of 21, hence 21 is not a prime number).

Run the program using your own ID number to determine if it is a prime number.

The program should use the exhaustive search approach to finding a divisor for n. It should start by checking to see if 2 is a divisor, and then checking successive integers until it finds a divisor (in which case it returns 0) or it is certain that there are no divisors (in which case it returns 1). Give some thought to the question “ what is the highest number that needs to be checked?”. You might think initially that it is n/2, but it is smaller than that.

PSEUDO CODE TOO.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
PROGRAMMING IN C. 1) The first program will compute compounded interest. Suppose you invest $1000.00 at...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Use C programming Make sure everything works well only upload Write a program that takes an...

    Use C programming Make sure everything works well only upload Write a program that takes an integer from standard input and prints all prime numbers that are smaller than it to standard output. Recall that a prime number is a natural number greater than 1 whose only positive divisors are 1 and itself. At the start of the program, prompt the user to input a number by printing "Input a number greater than 2:\n". If the user's input is less...

  • Write a program in Python that computes the interest accrued on an account. You can modify...

    Write a program in Python that computes the interest accrued on an account. You can modify the “futval.py” program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute...

  • IN PYHTON CODE Question #3 Produce a function prime_factors.dict that has one integer variable n that...

    IN PYHTON CODE Question #3 Produce a function prime_factors.dict that has one integer variable n that is assumed to be greater than 1. The function will return a dictionary with keys the integers from 2 to n, inclusive, and with values the set of prime factors of each key. So, the command prime_factors.dict (8) will return the dictionary 2 123,3: 3),4 2),5 (53,6 2,3),7:7),8 {2)) Note that even though the prime number 2 appears twice in the prime fac- torization...

  • Q#1: Write a C++ program to enter a number, compute and print the following: - Sum...

    Q#1: Write a C++ program to enter a number, compute and print the following: - Sum of even digits in the number - Count of even digits in the number - Count of digits below 5 For example, if the input is 3429, then Sum of even digits in the number = 6 Count of even digits in the number = 2 Count of digits below 5 = 3

  • Is Prime Number In this program, you will be using C++ programming constructs, such as functions....

    Is Prime Number In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter a positive integer, and outputs a message indicating whether the integer is a prime number. If the user enters a negative integer, output an error message. isPrime Create a function called isPrime that contains one integer parameter, and returns a boolean result. If the integer input is a prime number, then this function returns...

  • Assignment Develop a program to analyze one or more numbers entered by a user. The user...

    Assignment Develop a program to analyze one or more numbers entered by a user. The user may enter one or more numbers for analysis. Input should be limited to numbers from 1 through 1000. Determine if a number is a prime number or not. A prime number is one whose only exact divisors are 1 and the number itself (such as 2, 3, 5, 7, etc.). For non-prime numbers, output a list of all divisors of the number. Format your...

  • I need help with this exercise. Thank you for your help Language is C++ 6. Write...

    I need help with this exercise. Thank you for your help Language is C++ 6. Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd inte- ger is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)

  • Use the switch structure to write a MATLAB program to compute the amount of money that...

    Use the switch structure to write a MATLAB program to compute the amount of money that accumulates in a savings account in one year. The program should accept the following input: the initial amount of money deposited in the account; the frequency of interest compounding (monthly, quarterly, semiannually, or annually); and the interest rate. Run your program for a $10000 initial deposit for each case; use a 4 percent interest rate. Compare the amounts of money that accumulate for each...

  • (1 point) Suppose you invest $18,820.00 into an account earning an interest rate of 2.823% compounded...

    (1 point) Suppose you invest $18,820.00 into an account earning an interest rate of 2.823% compounded continuously for 1 year(s) and thereafter earning an interest rate of 3.315% compounded daily. How much money is in the account after 8 years? The amount in the account is (Note: Your answer should have a dollar sign and be accurate to two decimal places)

  • C programming! Write a program that reads integers until 0 and prints the sum of values...

    C programming! Write a program that reads integers until 0 and prints the sum of values on odd positions minus the sum of values on even positions. Let ?1, ?2, … , ??, 0 be the input sequence. Then the program prints the value of ?1 − ?2 + ?3 − ?4 + ⋯ ??. The input is a sequence of integers that always contains at least 0 and the output will be a single number. For example, for input...

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