Advertisement
Guest User

Untitled

a guest
May 17th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <math.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. double f(double x) { return sqrt(4-x*x) ; }
  8.  
  9. int main()
  10. {
  11. double x = 1.0, h = 0.01;
  12. double fc;
  13. //fc = (f(x+h) - f(x-h))/(2*h);
  14. //fc = (f(x) - f(x - h)) / h;
  15. fc = (f(x + h) - f(x)) / h;
  16. printf("%f\n", fc);
  17.  
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement