#include <iostream.h> #include <math.h> float asqrt (float x, float precision) { float guess; guess = 1.0; while (fabs(guess*guess-x) >= precision) { guess = 0.5 * (guess + (x / guess)); } return (guess); } int main () { float x, precision; cout << "Enter a real number and the precision: "; cin >> x >> precision; cout << "sqrt(" << x << ") is almost " << asqrt(x,precision) << endl; return(0); }

All Computer Programming languages and its basics (C,C++,JAVA,PHP,SAP(ALL MODULES)

Showing posts with label

**qrt()**. Show all postsShowing posts with label

**qrt()**. Show all posts## Tuesday, 15 April 2014

### Compute Square root Using Newtons Method

Subscribe to:
Posts (Atom)