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 is oops c?
Write a program to find factorial of a number using recursive function.
What does 4d mean in c?
Why c is procedure oriented?
Can we replace the struct function in tree syntax with a union?
What is derived datatype in c?
Does c have an equivalent to pascals with statement?
Which programming language is best for getting job 2020?
how many key words availabel in c a) 28 b) 31 c) 32
Why functions are used in c?
Can you write the algorithm for Queue?
Why isn't it being handled properly?
Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent
Why is structure important for a child?
What are the disadvantages of c language?