Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiply, divide & square root without using arithmetic operators

Tags:

java

c++

logic

How can I multiply and divide without using arithmetic operators? I read similar question here but i still have problem to multiply and divide.

Also, how can square root be calculated without using math functions?

like image 391
nebula Avatar asked Aug 01 '26 10:08

nebula


1 Answers

if you have addition and negation, as in the highest voted answer to the post you gave, you can use looped additions and subtractions to implement multiplication and division.

As for the square root, just implement Newton's Iteration on the basis of the operations from step 1.

like image 199
moooeeeep Avatar answered Aug 04 '26 01:08

moooeeeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!