vinijasreevalsam
BAN USER
- 0of 0 votes
AnswersIn DPS School, Cadbury bars have to be distributed to children waiting in a queue. Each Cadbury bar is rectangular in shape. Consider its side lengths are integer values.
- vinijasreevalsam in United States
The distribution procedure is as follows:-
1. If bar is not square in shape, then the largest possible square piece of Cadbury is broken and given to the first child in queue.
2. If bar is square in shape, then complete bar is given to the first child in queue.
Once a child receives his share of Cadbury, he leaves the queue. The remaining portion of the Cadbury bar is dealt in same fashion and the whole or a portion of it is given to the next child in the queue.
School has got a carton of Cadbury bars to be distributed among the children all over the School. The Cadbury bars in the carton are of different sizes. A bar of length i and breadth j is considered to be different from a bar of length j and breadth i.
For every i such that M<=i<=N and every j such that P<=j<=Q (where M, N, P and Q are integers). Each Cadbury bar in carton is unique in length (i) and breath(j).
Given the values of M, N, P and Q (where M, N values are the ranges for length of Cadbury and P, Q values are the ranges for breadth of Cadbury). Find the number of children who will receive Cadbury from the carton.
Input Specification:
M, N, P, Q are of integer type (M, N values are the ranges for length of Cadbury bar. P, Q values are the ranges for breadth of Cadbury bar).
Output Specification:
Number of children who will receive Cadbury bar from the carton.| Report Duplicate | Flag | PURGE
- -1of 1 vote
AnswersWrite a program to find the given number N is EVEN or NOT.
- vinijasreevalsam in India| Report Duplicate | Flag | PURGE
Software Engineer - 0of 0 votes
AnswersConsider its side lengths are integer values.
- vinijasreevalsam in India
1. If bar is not square in shape, then the largest possible square piece of Cadbury is broken and given to the first child in queue.
2. If bar is square in shape, then complete bar is given to the first child in queue.| Report Duplicate | Flag | PURGE
Agilent Technologies Software Engineer
bool isEven(int num) {
- vinijasreevalsam May 18, 2016if (num & 1) {
return false;
}
else {
return true;
}
}