If the remainder is greater than the divisor then you can divide it once more and get one more whole number and then have less remainders.
I think that a remainder can be larger than a divisor, but I'm not completely sure.
No, cause the remainder might be bigger than divisor.
int dividend,divisor,remainder; int division(int p,int q){ int quotient=1; /*if divisor and diviend are equal then quotient=1*/ if(p==q){ remainder=0; return 1; } /*if dividend is smaller than divisor then remainder=dividend*/ if(p<q){ remainder=p; return 0; } /*shift left till divisor > dividend*/ while(p>=q){ q<<=1; quotient<<=1; } /*shift right for one time so that divisor become smaller than dividend*/ q>>=1; quotient>>=1; /*again call division recurcively*/ quotient+=division(p-q,divisor); return quotient; } int main(){ cout<<"\nEnter dividend:"; cin>>dividend; cout<<"\nEnter divisor:"; cin>>divisor; cout<<"\nQuotient:"<<division(dividend,divisor); cout<<"\nRemainder:"<<remainder; //system("pause"); return 0; }
10 \ 2
It SHOULD always be less than the divisor... Otherwise your answer is wrong.
Because if the remainder is greater, then you could "fit" another divisor value into it. if they are equal, then you can divide it easily. Thus, the remainder is always lower than the divisor.
No it shouldn't because the divisor should always be bigger.
Because if the remainder is greater, then you could "fit" another divisor value into it. if they are equal, then you can divide it easily. Thus, the remainder is always lower than the divisor.
24. It is always one less than the divisor.
If you divide correctly, the remainder will always be less than the divisor.
The remainder is less than the divisor because if the remainder was greater than the divisor, you have the wrong quotient. In other words, you should increase your quotient until your remainder is less than your divisor!
28. It is always one less than the divisor.
less than
A remainder can be any non-negative number that is less than the divisor. If the remainder is bigger than the divisor, the divisor can go into it another one (or more) times until the remainder is brought into that range.
Nothing. The remainder has to be less than the divisor.
62. One less than the divisor.