0

How to divide two numbers without using arithmetic expression.

30th Oct 2017, 5:13 PM
vishal
4 Réponses
+ 4
Division is basically...how many times THIS thing fits into THAT thing. To get at the idea, if I were using a physical measuring ruler and piece of paper: [ ruler ] [ paper ] I'd run my pencil to the end of the paper, make a mark on the ruler, then set the paper down again on the other side and repeat (looks like we can at least divide by 2). [ ruler x x ] .............^[ paper ] The ruler has a certain length, so does the paper, and languages like Java can loop from start -> finish of something with length. I suspect Java also has objects with a length attribute (and methods) that you can use to count (and query the count) without using arithmetic.
30th Oct 2017, 7:02 PM
Kirk Schafer
Kirk Schafer - avatar
- 1
If the second is a power of 2, use bit shift.
30th Oct 2017, 5:26 PM
John Wells
John Wells - avatar
- 1
Code plz
30th Oct 2017, 5:27 PM
vishal