Question
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
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started