Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main() {
- double money;
- cin >> money;
- int year;
- cin >> year;
- int ivanchoEge = 18;
- for (int i = 1800; i <= year; i++) {
- money -= 12000;
- if (i % 2 == 1) {
- money -= 50 * ivanchoEge;
- }
- ivanchoEge++;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (money < 0) {
- cout << "He will need " << abs(money) << " dollars to survive.\n";
- }
- else {
- cout << "Yes! He will live a carefree life and will have " << money << " dollars left.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement