Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Abdulazizsayed/205f0892db786f58750f29ba0bc5d9de to your computer and use it in GitHub Desktop.
Save Abdulazizsayed/205f0892db786f58750f29ba0bc5d9de to your computer and use it in GitHub Desktop.
the pabilonion method for square root
#include <iostream>
using namespace std;
int main()
{
int e=1,n;
cout << "enter the required num : ";
cin >> n;
for (int i=0; i<1000 ; i++)
{
e = (e+(n/e))/2;
}
cout << "the sqr of " << n << " is : " << e;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment