Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. double f(double x){
  5. double a = sqrt(0.6*x+1.7)/(2.1*x + sqrt(0.7*x*x + 1));
  6. return a;
  7. }
  8.  
  9. int main(){
  10. double integral = 0;
  11. double a = 1.2, b = 2;
  12. double n = 1;
  13. double h = (b-a)/n;
  14. double x = a+h/2;
  15. while(x<b){
  16. integral += f(x);
  17. x+=h;
  18. }
  19. std::cout << integral << std::endl;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement