67 154
Assignments Done
99,4%
Successfully Done
In November 2018

Answer to Question #17761 in C++ for apoorva

Question #17761
write a function that takes two int arguments and returns reference of the odd number out of two.If both the arguments are odd,then the reference of the smaller one is returned. dont use printf n cin.getline .
Expert's answer

int& func(int& first, int& second)
{
if(first & 1 && second & 1)
return first>second?first:second;
else if(first & 1)
return first;
else if(second & 1)
return second;
else
return first>second?first:second;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions