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
cgl2010 tier 2 ki merit kya rhgi
36:4 :: 9: ?
Ms. Anurag Awasthi deposits an amount of Rs. 56500 to obtain a simple interest at the rats of 12% p.a. for 3 years. What total amount will Mr. Anurag Awasthi get at the end of 3 year?
No. of animals is 11 more than the no. of birds. If the no. of birds were the no. of animals and no. of animals were the no. of birds( ie., interchanging no.s of animals and birds.), the total no. of legs get reduced by one fifth (1/5). How many no. of birds and animals were there?
A son and father goes for boating in river upstream . After rowing for 1 mile son notices the hat of his father falling in the river. After 5min. he tells his father that his hat has fallen. So they turn around and are able to pick the hat at the point from where they began boating after 5 min.Tell the speed of river.
A small town's industries have a total turnover of Rs. 25,00,000. If the town council plans to raise Rs.170,000 through octroi levy, what % levy should it charge on the industries?
electrical question in diploma level
Two distinct no's are taken from 1,2,3,4......28. Find the probability that their sum is less than 13
1,2,3,4,5,6,7,8,9 station. route between any 2 station is there only if the 2 digit nob. is divisible by 3. e.g. route exist between 1 to 2 because 12 is divisible by 3 how many station have routes to 8 either direct or indirect
The numbers A, B and C make a sum of 98. If the ratio A:B is 2:3 and that B:C is 5:8, the third number would be
Two coins one with HEAD IN BOTH SIDES and the other coin HEAD IN ONE SIDE AND TAIL IN THE OTHER SIDE is in a box,a coin is taken at random and FOUND HEAD IN ONE SIDE .what is the probability that THE OTHER SIDE IS HEAD?
The sum of the digits of a two digit number is 8.When 18 is added to the number, the digits are reversed. Find the number?
Find the value of @@+25-++@16, where @ denotes "square" and + denotes "square root".
Tata Tea cost rupees 95 per kg, Red label costs rupees 100 per kg and Lipton cost rs 70 per kg. How many kgs of each should be blended to produce 100 kg mixture worth Rs.90 per kg, give that the quantity of Red label and Lipton are equal.
The area of the maximum size of the circle described from the 10 square inch square?