my solution so far : #include <stdio.h> #include <stdlib.h> /*const double depos
ID: 3533146 • Letter: M
Question
my solution so far :
#include <stdio.h>
#include <stdlib.h>
/*const double deposits[31] = {
80, 140, 110, 90, 180, 0, 0, 90, 70, 40, 120, 200,
0, 0, 80, 90, 110, 130, 170, 0, 0, 100, 60, 50, 120, 190,
0, 0, 120, 100, 180
};*/
const char *days[7] = {
"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"
};
int main() {
int i;
int withdraw;
double balance = 0;
double deposits[31];
for (i = 0; i < 31; i++) {
printf("Enter deposit for the %d: ", i+1);
scanf("%lf", &deposits[i]);
}
for (i = 0; i < 31; i++) {
withdraw = 0;
if (i % 7 == 4) withdraw = 300;
balance += deposits[i] - withdraw;
balance *= 1 + 7.25 / 365;
printf("%s %d: deposit=%.2f$, withdrawal=%d$, interest=%.5f%, balance=%.2f$ ",
days[i%7], i+1, deposits[i], withdraw, 7.25/365, balance);
}
return EXIT_SUCCESS;
}
PLEASE help me fix it and help me with flowchart for the question i don't understand what that means exactly
Explanation / Answer
Your interest calculation looked a little off, it's daily compound so the interest calculation is a bit different your common interest calculation. Even i'm not sure if I did it correctly since deposits daily will change the interest gained to some degree.
I pretty much copied what you had and changed some of the equations and display. For interest I think they wanted you to show you interest gained in dollars and not percentage for that day.
I didn't get the compiler errors that you mentioned. If you still get them I'll look into it and see whats causing it.
Enjoy!
http://ideone.com/Agwh2M
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.