Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int k;
- cin >> k;
- int brojac = 1;
- int sum = 0;
- int broj = 1;
- while(brojac <= k) {
- sum += broj;
- broj += 3;
- brojac++;
- }
- cout << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement