Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void outputheader()
- {
- /* add code to output the table header */
- /* --> between here */
- printf(" DAY DEPOSIT BALANCE\n");
- printf(" --- ------- -------\n");
- /* <-- and here */
- }
- int generatetable(double targettotal /* add parameter here */)
- {
- /* add declarations and code to generate the table */
- /* (based on the parameter value) */
- /* and return the number of days required to accumulate the specified amount */
- /* --> between here */
- double balance, deposit;
- int days;
- balance = 0.00;
- deposit = 0.01;
- days = 1;
- while (balance < targettotal) {
- balance += deposit;
- printf("%10d %7.2lf %15.2lf\n", days, deposit, balance);
- ++days;
- deposit *= 2;
- }
- /* <-- and here */
- }
- int main(void)
- {
- /* add declarations and code to input the amount of money, */
- /* call the function to output the table header, */
- /* and call the function to generate the table, */
- /* and print the number of days required */
- /* --> between here */
- double targettotal;
- scanf_s("%lf\n", &targettotal);
- generatetable(double);
- /* <-- and here */
- while (1) getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement