Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char** argv)
  9. {
  10. int przedzial,kwadratdod=0,kwadratuj=0,sumadod=0,sumauj=0,sumawsz=0;
  11.  
  12. cout << "Podaj przedzial ";
  13. cin >> przedzial;
  14.  
  15. for (int i=0; i<=przedzial; i++)
  16. {
  17. kwadratdod=i*i;
  18. sumadod+=kwadratdod;
  19. }
  20.  
  21. for (int i=0; i>=-przedzial; i--)
  22. {
  23. kwadratuj=i*i;
  24. sumauj+=kwadratuj;
  25. }
  26.  
  27. sumawsz=sumadod+sumauj;
  28.  
  29. cout << sumawsz << endl;
  30.  
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement