Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int p, d, n, zbir = 0;
- cin >> p >> d >> n;
- for (int i = 1; i < n; i++)
- {
- if (i == 1)
- {
- zbir += p;
- }
- else {p += d;
- zbir += p;
- }
- }
- cout << zbir << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement