Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "ru");
- double people, n, x, years = 0;
- cout << "Введите исходное число жиетелей: ";
- cin >> people;
- cout << "Введите натуральное число n: ";
- cin >> n;
- x = people * 3;
- for (;; years++)
- {
- people *= 1 + 1.0 / n;
- if (people >= x)
- break;
- }
- cout << years << endl;
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement