You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
292 B
28 lines
292 B
12 months ago
|
int fsqrt(int a)
|
||
|
{
|
||
|
int x0=0;
|
||
|
int x1;
|
||
|
x1=a/2;
|
||
|
while(x0-x1!=0)
|
||
|
{
|
||
|
x0=x1;
|
||
|
x1=(x0+a/x0);
|
||
|
x1=x1/2;
|
||
|
}
|
||
|
|
||
|
return x1;
|
||
|
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int a;
|
||
|
a=400;
|
||
|
int res;
|
||
|
res=fsqrt(a);
|
||
|
putint(res);
|
||
|
res = 10;
|
||
|
putch(res);
|
||
|
return 0;
|
||
|
}
|