No, cause the remainder might be bigger than divisor.
Chat with our AI personalities
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; }
125
i don't know what the problem is so um here are some examples i guessMULTIPLICATION5xX=20In this problem X=45x4=20SUBTRACTION80-X=43In this problem X=3780-37=43ADDITION5+X=98In this problem X=935+93=98Sorry i cant do the division example but i don't have a division signhope this will help youNinjainon123 out
31
"Parentheses, Exponents, Multiplication and Division, and Addition and Subtraction." Therefore multiplication and division are equal.