#WSQ13 #TC1017

For some reason I couldn’t upload this WSQ to my github but here it is: 

<iostream>

using namespace std;

 

float babyloninan(float num, float guess)

{

float root = ((guess + (num/guess))/2.0);

float root2 = ((root + (num/root))/2.0);

 

return root2;

 

}

 

int main()

{

float x,y,raizcuadrada;

 

cout<<“Ingresa el numero del cual quiere saber la raiz cuadrada: “;

cin>>x;

 

cout<<endl;

 

cout<<“Ingresa un numero que se aproxime al resultado de la raiz: “;

 

cin>>y;

 

cout<<endl;

 

raizcuadrada= babyloninan(x,y);

 

cout<<“La raiz cuadrada de ” <<x<< ” es : “<<raizcuadrada;

 

return 0;

}

 

CC BY 4.0 #WSQ13 #TC1017 by Edgar Pruneda is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.