Created
April 6, 2017 14:07
-
-
Save Adals20/a2cd7ce93e9997a3d35cb8ff07e51443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
float Baby(double x){ | |
double error = 0.0001, y; | |
y = x; | |
while((y-x/y)>error){ | |
y = (y+x/y)/2; | |
} | |
return y; | |
} | |
int main(){ | |
double x, y; | |
cout << "Ingrese un numero para calcular la raiz por el metodo Babylonian: "; | |
cin >> x; | |
y = Baby(x); | |
cout << "El resultado es: "<<y<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment