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 the sizeof () operator?
Can a pointer point to null?
Is there a way to switch on strings?
Explain the difference between call by value and call by reference in c language?
How to create struct variables?
What is null pointer in c?
Write a progarm to find the length of string using switch case?
Why does this code crash?
How is pointer initialized in c?
What is console in c language?
What is the g value paradox?
How can I convert a number to a string?
What are the types of variables in c?
Explain the use of keyword 'register' with respect to variables.
What are the similarities between c and c++?