Hi.
I was reading a magzine.
It had this question
Without using /,% and * operators. write a function to divide a number by 3.
Can anyone help...
Hi.
I was reading a magzine.
It had this question
Without using /,% and * operators. write a function to divide a number by 3.
Can anyone help...
Strikes me as a homework problem. Ever heard of logarithms?
Division is really repeated subtraction. Just take a base number, such as 8152 and subtract 3 from it, but add 1 to the count. When the number to subtract is less than the amount to be subtracted, stop. You have the answer and the remainder, if any. Just adding and subtracting is used.
High elevation is the best elevation. The higher, the better the view!
My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express
cross-poster!
arithmatic operations without using them..
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Threads merged with duplicate deleted.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Looks like an Adobe test from last year.
http://www.google.com/search?q=%22wr...hl=en&filter=0
THanks