Advertisement
mfgnik

Untitled

Jun 2nd, 2020
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. int main() {
  5.     float percents_amt, rubles_amt, cents_amt, years, res, cnt = 0;
  6.     std::cin >> percents_amt >> rubles_amt >> cents_amt >> years;
  7.     res = rubles_amt * 100 + cents_amt;
  8.     while (cnt < years) {
  9.         res += res * percents_amt / 100;
  10.         res = trunc(res);
  11.         cnt += 1;
  12.     }
  13.     std::cout << int(res) / 100 << " " << int(res) % 100;
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement