Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 are the three constants used in c?

929


What is C language ?

1901


What is return type in c?

1074


Is the exit() function same as the return statement? Explain.

1035


List the different types of c tokens?

1010


What is scope rule in c?

1014


Differentiate between new and malloc(), delete and free() ?

1133


Calculate 1*2*3*____*n using recursive function??

1981


Explain high-order and low-order bytes.

1048


Explain what is a program flowchart and explain how does it help in writing a program?

1043


What is the use of volatile?

1043


What is realloc in c?

1017


What are the types of unary operators?

1127


Subtract Two Number Without Using Subtraction Operator

780


Difference between constant pointer and pointer to a constant.

1064