Advertisement
DasShelmer

1.2.19

Oct 12th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     // No II.19
  6.     double a1, d, n, S;
  7.  
  8.     cout << "Enter a1, d, n = ";
  9.     cin >> a1 >> d >> n;
  10.     cout << endl;
  11.  
  12.     S = n/2 * (2 * a1 + (n - 1) * d);
  13.  
  14.     cout << "Result = "<< S << endl;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement