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;
}
Chat with our AI personalities
These are called operators. When doing a sum with more than one operator the rule is to multiply and divide first, and then do any addition or subtraction. A simple way to remember the order is "BODMAS." 'Brackets', 'other', 'division', 'multiplication', 'addition' and 'subtraction'. (Other refers to powers and indices)
What you have to do is you add up all the numbers then you divide by the number of numbers. ex. Say you have the numbers 45,56,39 and 35 you add them all up 45+56+39+35=175 then you divide 175/4(because there is 4 numbers)=43.75
To convert from mm to inches, divide by 25.4. From there, you can divide by 12 (division with remainder), to convert to feet and inches.
Divide by 3 multiply by 2
12, 6, 4, 3, 2, and 1 are the divisors of 12 because these numbers divide 12 without leaving any remainder.