How to find remainder of two numbers without using (%)
operator

Answer Posted / shubham

using formula "Dividend = Quotient x Divisor + Remainder"
the c++ code for this would be

#include<iostream.h>
void main()
{
int a,b,q,r;
cout<<"Enter a ";
cin>>a;
cout<<"Enter b ";
cin>>b;
q=a/b;
r=a-q*b;
cout<<"Remender="<<r;
}

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

58,27,12,x,2,1. Find x.

890


There are two candles with different thickness, but are of equal length. The thicker one lasts of six hours and the thinner candle last for 2 hours less than the thicker one. Suresh lights the two candles at the same time. When he went to bed he saw the thicker one is twice the length of the thinner one. For how long did Suresh light the two candles.

695


Given a collection of points P in the plane, a 1-set is a point in P that can be separated from the rest by a line; i.e. the point lies on one side of the line while the others lie on the other side. The number of 1-sets of P is denoted by n1(P). The maximum value of n1(P) over all configurations P of 19 points in the plane is 18 9 3

1680


Fallin height is proportional to square of the time. One object falls 64 cm in 2 sec. than in 6 sec. from how much height the object will fall?

750


where is genarak driving aptitude

1677






f(X)= 2X-1 + f(X-1) if X is not equal to zeroandiff(X=0)=0, Value of f(16)+f(15)-480

783


hai frnds pls give me some tips and traps about HP software company interview for freshers.am a B.E CSE fresher.hoe will be the interview?how many days it will be conducted?how will be apps round?technical round?hr round?pls help me if any one known means.send me that pattern by vijay ,chennai

1967


Find the distance when they meet from starting point.

732


3 angles or 3 sides r given. Which will form a triangle?

659


If A is travelling at 72 km per hour on a highway. B is travelling at a speed of 25 meters per second on a highway. What is the difference in their speeds in m/sec.

679


there is a matrix N x N .Its elements consist of either value =1 or value=0. If there is a any zero in the row, then the output matrix should have all zeroes in that row. If there is a single zero in any column then that column should have all zeroes n the output matrix. write the function to perform these operations. i want a solution in c/c++ language

1898


pls send me andhra bank clerk model papers&syllabus

1730


When I was married 10 years back my wife was the sixth member of my family. Now I have a baby. Today my father was dead and I had a new baby. Now the average age of my family is the same as that when I was married. Find the age of my father when he was 60.

666


If m/n = 5/4 , then 2m+n= ?

702


What is the value of a property, which has been insured at the rate of 1/6% of its value, if the annual premium paid on it is Rs. 83.33 (in Rs.)?

1322