Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int years;
- double tones, percentage, first_year;
- cin >> years >> first_year >> percentage;
- int current_year = 1;
- if (years > 0) {
- tones = first_year;
- }
- else {
- tones = 0;
- }
- while (current_year < years) {
- tones = tones + tones * percentage / 100.0;
- current_year++;
- }
- cout << int(tones * 100) / 100.0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement