Advertisement
Gandalf_the_Green

Untitled

Mar 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. using namespace std;
  3.  
  4. double squre_root(double S,int times){
  5. double x1;
  6. double x0=S/2;
  7. while(times>0){
  8. x1=(x0+S/x0)/2;
  9. x0=x1;
  10. times--;
  11. }
  12. printf("%f",x1);
  13. }
  14. int main()
  15. {
  16. double s = 400;
  17. int t = 10;
  18. squre_root(s,t);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement