Advertisement
kirya_shkolnik

C++ - Никита - 4

Jan 22nd, 2021
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. double func(double x) {
  7.     return (pow(sin(x),3) - 3 );
  8. }
  9. double RegCikl(double a, double b, double h, double &Proizv) {
  10.     double x, y;
  11.     double Sum = 0;
  12.     for (x = a; x <= b; x += h) {
  13.         y = func(x);
  14.         Sum+=y;
  15.         Proizv*=y;
  16.     }
  17.     return Sum;
  18. }
  19.  
  20.  
  21.  
  22. int main()
  23. {
  24.     double a,b,h, Proizv = 1;
  25.     cin >> a >> b >> h;
  26.     double Sum = RegCikl(a,b,h, Proizv);
  27.     cout << Sum << " " << Proizv;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement