Program to find square root of parameter in c++ without using sqrt
Answers
Answered by
0
int sqrt(int x)
{
int quotient = 0;
int i = 0;
bool resultfound = false;
while (resultfound == false)
{
if (i*i == x)
{
quotient = i;
resultfound = true;
}
i++;
}
return quotient;
}
{
int quotient = 0;
int i = 0;
bool resultfound = false;
while (resultfound == false)
{
if (i*i == x)
{
quotient = i;
resultfound = true;
}
i++;
}
return quotient;
}
Similar questions