Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- void main()
- {
- float x, y, p, year = 0;
- cout << "input x p y = ";
- cin >> x >> p >> y;
- while (x < y)
- {
- year++;
- x += x / 100 * p;
- x = nearbyint(x * 100) / 100;
- }
- cout << "the result is " << year << "\n\n";
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement