
Patrick B. answered 08/30/20
Math and computer tutor/teacher
Here is some psuedo-code:
//lienar searches until the quotient = 1,2,3.... times the divisor exceeds the dividend
quotient=1;
int partial_product=-1;
while ( (partial_product = quotient * divisor) < dividend)
{
quotient ++;
}
partial_product = (--quotient)*divisor;
remainder = dividend - partial_product;
ex. 1234567 divided by 890
890 is the DIVISOR; 1234567 is the dividend
quotient quotient * divisor
1 890
2 1780
3 2670
4 3560
....
1386 1233540
1387 1234430
1388 1235320 <-- too big !!!
the quotient is 1387
1234567
- 1234430
-----------
137 <--- remainder
Dorsa R.
thanks for answering but i get this error : 1.(it is undeclared ) quotient=1; 2.(as you know we have strings here so they are "char" but others are "int" so i get this error for while loop :invalid operands to binary have int and char ) while ( (partial_product = quotient * divisor) < dividend) { quotient ++; } 3.(remainder is undeclared too ) remainder = dividend - partial_product;08/31/20