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 does void main return?
Create a simple code fragment that will swap the values of two variables num1 and num2.
What is an arrays?
What is the purpose of realloc()?
What is union and structure in c?
find out largest elemant of diagonalmatrix
Explain what are reserved words?
program to convert a integer to string in c language'
How many bytes is a struct in c?
Explain the concept and use of type void.
What does d mean?
What is the difference between fread buffer() and fwrite buffer()?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What is a const pointer?