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



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

Answer / 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

More General Aptitude Interview Questions

If A can complete a work in 6 hours, and B can complete it in 8 hours, then how much time would they take to complete the work together?

5 Answers   Wipro,


Find the wrong number in the given series: 2,3,12,37,86,166,288

6 Answers   Amity, Axis Bank, BEd, Infosys, SSC, Wipro,


A man gets x/y of Rs.10 and y/x of Rs.10. He returns Rs.20. The Answer choices are a) He may not lose b) He may lose c) He always loses d) Cannot be Determined

2 Answers   CTS,


dear sir I need ordance factories non technical model question paper so pls send me the model paper my E-mail Id is sakthisaa@gmail.com

0 Answers  


rajesh purchase 3 types of candies with 1 doller costin:$0.05,$0.02,$0.01 he purchase 10 candies of $.01 find quantity he buys for different candies

8 Answers   CMC, Patni,






Two trains are traveling at 18kmph and are 60 km apart. There is flying in the train. It flies at 80kmph. It flies and hits the second train and then it starts to oscillate between the two trains. At one instance when the two trains colloide it dies. At what distance travel by the fly.

0 Answers   Accenture,


in a mixture R is 2 parts and S is 1 part. In order to make S to 25% of the mixture how r is needed ? give the steps plz.....

2 Answers   Lauda, TCS,


1 chocolate cost is Rs.1 & if we return 3 wrapers(covers) of chocolate we get 1 more chocolate. If u have Rs.15 how many chocolates do u get...?

54 Answers   Accenture, Broadridge, DaVita, HP, Infosys, iNovate, Mphasis, TCS, Tesco, TFD, Zoho,


Please send the model question paper to my email id this is my email id :lalitha_7stars@rediffmail.com

0 Answers  


I'm also facing the same problem. plz send me model question papers and answers which help me to face interview for clerical staff in sbi.

1 Answers  


why are you interested in the field of Human Rights?

0 Answers   Bio Sourcing, NGO,


three taps a, b, c, together can fill an empty cistern in 10 minutes. the tap a alone can fill it in 30 minutesand the tap b alone 40 minutes. how long will the tap c alone take to fill it

3 Answers   CDS,


Categories