Advertisement
kostes

6

Jan 15th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, p, x, y, s;
  6. cout << "N = ";
  7. cin >> n;
  8. cout << "p = ";
  9. cin >> p;
  10. cout << "x = ";
  11. cin >> x;
  12. cout << "y = ";
  13. cin >> y;
  14. cout << "s = ";
  15. cin >> s;
  16. double frst = (1 - (double)x / 100);
  17. double scnd = (1 + (double)y / 100);
  18. for(int i = 1; i <= s; i++)
  19. {
  20. if(i <= p)
  21. {
  22. n *= frst;
  23. }
  24. else n *= scnd;
  25. }
  26. cout << n;
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement