Question

C CODE The mathematical operation min (x, y) can be represented by the conditional expression a...

C CODE

The mathematical operation min (x, y) can be represented by the conditional expression
a = ( x < y ) ? x : y
In a similar fashion, using only conditional expressions, describe the mathematical operations
a = min ( x, y, z )   and     a = max ( x, y, z )
Hint: You may use if statements.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a = min ( x, y, z )

Answer:

a = ( x < y && x < z) ? x : ((y < z) ? y : z)

a = max ( x, y, z )

Answer:

a = ( x > y && x > z) ? x : ((y > z) ? y : z)

Add a comment
Know the answer?
Add Answer to:
C CODE The mathematical operation min (x, y) can be represented by the conditional expression a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT