Advertisement
_Darya___

дз 4.1

Nov 25th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. cin>>n;
  9. if(n>0){
  10. int f=0;
  11. for(int i=1;i<=n;i+=1){
  12. f+=i*i;
  13. }
  14. cout<<f;
  15. }
  16. else {
  17. cout << "Bang bang" << endl;
  18. }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement