Advertisement
alexappelt

Untitled

Jul 10th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main(int argc, char const *argv[])
  6. {
  7.    
  8.  
  9.     int a=0 , i=0, soma=0;
  10.  
  11.     cin>>a;
  12.  
  13.     if(a==0){
  14.         cout<<endl;
  15.     }
  16.     else{
  17.     for(i=a; i>=0;i-- ){
  18.     soma= pow(i,2) + soma;
  19.     }
  20.  
  21.     cout<<soma<<endl;
  22. }
  23.  
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement