This is what I have http://www.pastebucket.com/21551 The program needs to includ
ID: 3543425 • Letter: T
Question
This is what I have http://www.pastebucket.com/21551
The program needs to include a function to output the table header as well as a function to generate the table. The function that generates the table should be passed in a input parameter of type double that tells how much money is going to accumulate. The function should provide a return value to main that tells how many days it took to accumulate the funds.
My problem is what Im having touble making these two functions communicate with each other. Also have troubling with the deposit and balance part of the table.
Explanation / Answer
/***
Notes: Deposit: f(x)= 0.01 (2^x) where x is the number of days
Days: x = log base 2 (amount)
Balance: x = (first term)(1-r^n)/ (1-r) example:
***/
#include <stdio.h>
#include <math.h>
int amount, base = 2;
double days;
int x;
int header();
double table();
int main(void)
{
header();
table();
return 0;
}
int header() {
printf("Please enter the amount of money you want to accumulate: ");
scanf("%d", &amount);
days = (log2((amount)));
printf("It took %d days to accumulate at least $%d ", days, amount);
}
double table(){
printf("DAY DEPOSIT BALANCE ");
printf("--- ------- ------- ");
for (x = 1; x <= days; x++){
printf("%d ", x);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.