jusohatam

Untitled

Sep 24th, 2020
902
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double S, p, n, m, r, m_tmp;
  8.     cout << "Введите S, m, n: ";
  9.     cin >> S >> m >> n;
  10.     for (long int i = 0; p < 100000; ++i) {
  11.         p = i / 1000;
  12.         r = p / 100;
  13.         m_tmp = (S * r * pow(1+r, n)) / (12*(pow(1+r, n)-1));
  14.         if (m_tmp > m) {
  15.             break;
  16.         };
  17.     }
  18.     cout << "Полученный процент p: " << p << "\n";
  19. }
  20.  
RAW Paste Data