Advertisement
_Aivan_

Special 4 Danik

Nov 13th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. setlocale(LC_ALL, "ru");
  9. double people, n, x, years = 0;
  10. cout << "Введите исходное число жиетелей: ";
  11. cin >> people;
  12. cout << "Введите натуральное число n: ";
  13. cin >> n;
  14. x = people * 3;
  15. for (;; years++)
  16. {
  17. people *= 1 + 1.0 / n;
  18. if (people >= x)
  19. break;
  20. }
  21. cout << years << endl;
  22.  
  23. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement