Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a, b; int N;
  9. cout << "a,b,N->";
  10. cin >> a >> b >> N;
  11.  
  12. double s = (2 * a + b*(N-1)) / 2;
  13. cout << "s=" << s << '\n';
  14. return 0;
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement