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
In a class composed of x girls and y boys what part of the class is composed of girls
If A = x3y2x3y2 and B=xy3xy3, then find the HCF of A, B
A train 100 meter long takes 3 second to cross a man walking at the rate of 6km/hr in a direction opposite to that of the train. Find the speed of the train.
Find the longest palendrom in a string? Example Input: abfgerccdedccfgfer Output: ccdedcc i want a solution in C/C++ language
Two lemons cost 10 cents. Then one and a half dozen cost
A gardener plants 100 meters towards east, next 100 meters towards north,next 100 meters towards west. 98 meters towards east, 96 meters towards north and 96 meters towards west, 94 meters towards south. and 94 meters towards east and so on. If a person walks between the trees what is the total distance travelled by him before he reaches the center.
4i+8j+10k. something like this.
Ram, Shyam and Gumnaam are friends.Ram is a widower and lives alone and his sister takes care of him. Shyam is a bachelor and his niece cooks his food and looks after his house. Gumnaam is married to Gita and lives in large house in the same town. Gita gives the idea that all of them could stay together in the house and share monthly expenses equally. During their first month of living together, each person contributed Rs.25. At the end of the month, it was found that Rs 92 was the expense so the remaining amount was distributed equally among everyone. The distribution was such that everyone received a whole number of Rupees. How much did each person receive?
A person has his own coach&whenever he goes to railway station he takes his coach.One day he was supposed to reach the railway station at 5 O'clock.But he finished his work early and reached at 3 O'clock. Then he rung up his residence and asked to send the coach immediately. He came to know that the coach has left just now to the railway station. He thought that the coach has left just now to the railway station.He thought that he should not waste his time and started moving towards his residence at the speed of 3mi/hr.On the way,he gets the coach and reaches home at 6 o'clock.How far is his residence from railway station.
If the ratio of the areas of 2 queres is 2:1, then the ratio of the perimeters of the squares is
the average of seven numbers is 2.5 then their product
An array was given and we were required to write a function : int CalculateThirdHighest(int a[ ]) : which calculates the third highest number in the array. While coding in C remember to calculate the length of array using formulae length of array=sizeof(a)/sizeof(int). Because the number of elements of array were not passed as argument. i want a solution in C/C++ language
Five trays cost is 0.35 each and dozen-----
Alphametics are puzzles where each letter stands for a different digit. Here are two alphametics. No word can begin with a zero. We’ve started you out with some of the letters. BASE + BALL -------------- GAMES what these alphabets represent
Name of the cipla medicine product