Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int main(int argc, char** argv)
- {
- int przedzial,kwadratdod=0,kwadratuj=0,sumadod=0,sumauj=0,sumawsz=0;
- cout << "Podaj przedzial ";
- cin >> przedzial;
- for (int i=0; i<=przedzial; i++)
- {
- kwadratdod=i*i;
- sumadod+=kwadratdod;
- }
- for (int i=0; i>=-przedzial; i--)
- {
- kwadratuj=i*i;
- sumauj+=kwadratuj;
- }
- sumawsz=sumadod+sumauj;
- cout << sumawsz << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement