josiftepe

Untitled

Nov 15th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int p=3;
  5. int main()
  6. {
  7.  
  8. int n;
  9. cin>>n;
  10. int x=0;
  11. n+=1;
  12.  
  13. int o=0;
  14. int k=1;
  15. int z=3;
  16.  
  17.  
  18.  
  19. for(int y; y<n; y+=1){
  20. o+=x;
  21. x+=p;
  22. p=p+3;
  23.  
  24. }
  25.  
  26. cout<<o;
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.     return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment