0

How we can find square root without using function??

5th Jan 2021, 1:49 PM
Hamed Taherkhani
Hamed Taherkhani - avatar
3 odpowiedzi
+ 1
float xsqrt(float num) { float x, sqrt; sqrt = num / 2; x = 0; while(sqrt != x){ x = sqrt; sqrt = ( num/x + x) / 2; } return (sqrt); }
5th Jan 2021, 1:57 PM
Muzammil
Muzammil - avatar
0
hamed02121 yes. but it's better to use functions to avoid writing twice.
5th Jan 2021, 1:53 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Can you define your logic?? Please.
5th Jan 2021, 2:15 PM
Hamed Taherkhani
Hamed Taherkhani - avatar