Increment a number without using arithmetic operators
All I want to do is increment the i++ at the end of the for loop without using arithmetic operators and I can only use bitwise operators. So no "+, ++, +=, , , = ,∗, /, %". An exception is that I can use addition for pointer arithmetic like in the line
result += multiplicand;
Would I have to change it into a while loop or how would I do that?
int result = 0;
int i = 0;
for (i=0; i<multiplier; i++){
result += multiplicand;
}
1 answer

What you are looking for is ShiftandAdd Multiplication:
Shiftandadd multiplication is similar to the multiplication performed by paper and pencil. This method adds the multiplicand X to itself Y times, where Y denotes the multiplier. To multiply two numbers by paper and pencil, the algorithm is to take the digits of the multiplier one at a time from right to left, multiplying the multiplicand by a single digit of the multiplier and placing the intermediate product in the appropriate positions to the left of the earlier results.
Give it a try and let me know if you are still lost