Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- int main()
- {
- float money_now;
- scanf("%f", &money_now);
- float annual_rate_of_return;
- scanf("%f", &annual_rate_of_return);
- float annual_genie_money;
- scanf("%f", &annual_genie_money);
- int your_age;
- scanf("%d", &your_age);
- float target_balance = 1000000.0;
- float current_balance = money_now;
- int age = your_age;
- while (current_balance < target_balance) {
- current_balance += annual_genie_money;
- current_balance *= (1 + annual_rate_of_return / 100);
- age++;
- }
- printf("%d\n", age);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement