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
There are A,B techers and C,D doctors.Find the possible no of combinations that should not be repeated more than once?
Price of product is reduced by 30%. What % should be increased to make it 100 % ?
JSW steel online test questions
2. Why would you choose a database system instead of simply storing data in operating system files? Give and explain advantages of using DBMS.
A certain street has 500 buildings. A sign-maker is contracted to number the houses from 1 to 500. How many zeroes will he need?
Find the next number in the series 1,2,5,10,,15,22--
Petrol prices increased by 40% expected hike in taxi & auto charges so, people may use public transport systems. What do you infer?
Hello My name is vijay right now I'm preparing for SBI po, I am good at aptitude but not better. I am lagging time you know competitive exams are to answer in span of time. So any website regarding aptitude short cuts or tricks Pls post to my mail. I am waiting
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.)?
There are 6 people W,H,M,C,G,F who are murderer, victim, judge, police, witness, hangman. There was no eyewitness only circumstantial witness. The murderer was sentenced to death. Read following statement and determine who is who.
There are 200 employees in a company. An external vendor is chosen to Serve coffee twice a day. 100 coffee cups were offered by the company but as an incentive to have the cups in tact at the end of the day, the company offered 30 paise for every cup remained safely and charged 90 paise for every broken cup. At an end of a day, the vendor received Rs. 24. How many cups did the vendor break? 10, 20, 8, 5?
The day before yesterday was WEDNESDAY then the day after 2morrow is?
A finishes a work in 12 days and B finishes same work in 14 days.If they work for a day alternately with A beginning, how many days will it take to complete the work?
in a market 4 man are standing .the average age of the four before 4years is 45,aftyer some days one man is added and his age is 49.what is the average weight of all?
If g (0)=g (1)=1 And: g (n)= g (n-1) + g (n –2) find g (6);