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


Please Help Members By Posting Answers For Below Questions

What is oops c?

614


Write a program to find factorial of a number using recursive function.

647


What does 4d mean in c?

950


Why c is procedure oriented?

575


Can we replace the struct function in tree syntax with a union?

783






What is derived datatype in c?

638


Does c have an equivalent to pascals with statement?

575


Which programming language is best for getting job 2020?

608


how many key words availabel in c a) 28 b) 31 c) 32

635


Why functions are used in c?

588


Can you write the algorithm for Queue?

1556


Why isn't it being handled properly?

646


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

1432


Why is structure important for a child?

604


What are the disadvantages of c language?

623