Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9. int n;
  10. cout << "Wprowadz N:" << endl;
  11. cin >> n;
  12.  
  13. double h = -3, a=-5, sum = a;
  14.  
  15. for (int i = 2; i<= n; i++) {
  16. a += h;
  17. sum += a;
  18. }
  19.  
  20. cout << "A:" << a<< endl;
  21. cout << "Sum:" << sum<< endl;
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement