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