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 does void main return?

1118


Create a simple code fragment that will swap the values of two variables num1 and num2.

1285


What is an arrays?

1072


What is the purpose of realloc()?

1139


What is union and structure in c?

1218


find out largest elemant of diagonalmatrix

2247


Explain what are reserved words?

1103


program to convert a integer to string in c language'

2453


How many bytes is a struct in c?

1164


Explain the concept and use of type void.

1112


What does d mean?

1085


What is the difference between fread buffer() and fwrite buffer()?

1171


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2740


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

2377


What is a const pointer?

1114