Q: Write a function to perform integer division without using either the / or * operators. Find a fast way to do it.
A:
void int_div(int dividend, int divisor)
{
if(divisor>dividend)
return;
remainder = 0;
quotient = 0;
while(remainder > divisor)
{
remainder = dividend - divisor;
quotient += 1;
}
return;
}
}
Advertisement