Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Programming Exercise 6-17 */
- // Chuckie Lucky won a million dollars (after taxes), which he places in an account that
- // earns 8% a year. On the last day of each year, Chuckie withdraws $100,000. Write a
- // program that finds out how many years it takes for Chuckie to empty his account.
- #include <stdio.h>
- int main(void)
- {
- float s = 1000000.0f;
- int year;
- for (year=0; s > 0; year++)
- {
- s -= 100000.0f;
- printf("Balance: %.1f\n", year, s);
- s += (s*1.08f);
- printf("Balance: %.1f\n", year, s);
- }
- printf("Bankrupt in %2d years with $ %.1f left \n", year, s);
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement