Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. double racine(double n);
  6.  
  7. int main()
  8. {
  9.   printf("%f\n", racine(4.000));
  10.  
  11.   return 0;
  12. }
  13.  
  14. double racine(double n)
  15. {
  16.   double u = n;
  17.   while (u*u-n > 0.0001)
  18.     {
  19.       u = ( 1 / 2 ) * (u + n / u);
  20.     }
  21.  
  22.   return u;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement