Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void main()
- {
- int n;
- int zbir = 0;
- cout << "Unesi broj n: " << endl;
- cin >> n;
- if (n > 20)
- {
- cout << "Broj n ne smije biti veci od 20" << endl;
- system("PAUSE");
- }
- for (int i = 1; i <= n; i++)
- {
- zbir += i * i;
- }
- cout << "Zbir kvadrata niza je: " << zbir << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement