program to get the remainder and quotant of given two
numbers with out using % and / operators?
Answer Posted / mahfooz alam
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"enter two number"<<endl;
int r,q=0,bi,s;
cin>>a>>b;
if(a<b)
{
s=a;
bi=b;
}
else
{
s=b;
bi=a;
}
r=bi-s;
q++;
while(r>=s)
{
q++;
r=r-s;
}//endl of while.*/
cout<<"remainder is "<<r<<" quotient is "<<q<<endl;
return 0;
}
| Is This Answer Correct ? | 13 Yes | 8 No |
Post New Answer View All Answers
What are the three constants used in c?
What is C language ?
What is return type in c?
Is the exit() function same as the return statement? Explain.
List the different types of c tokens?
What is scope rule in c?
Differentiate between new and malloc(), delete and free() ?
Calculate 1*2*3*____*n using recursive function??
Explain high-order and low-order bytes.
Explain what is a program flowchart and explain how does it help in writing a program?
What is the use of volatile?
What is realloc in c?
What are the types of unary operators?
Subtract Two Number Without Using Subtraction Operator
Difference between constant pointer and pointer to a constant.