Please give hints to write program to divide 40 by 2 without using division operator.
Printable View
Please give hints to write program to divide 40 by 2 without using division operator.
Study what the other operators do.
C Operator Precedence Table
Study the bitwise ones more carefully.
Just bear in mind that the equivalence of some bitwise operations with some mathematical operations is only guaranteed for unsigned integral types: don't rely on such equivalences for int, float, double ....
You might want to consider that log(a/b) == log(a) - log(b) in any base (for a and b both positive).
No division on the right hand side of that expression .....