Question: b. Consider the following simple piece of C code: if (x != 0) if (a >b) y = a/x; else y = b/x; else if

b. Consider the following simple piece of C code: if (x != 0) if (a >b) y = a/x; else y = b/x; else if (a >b) y = a/0.000001; else y = b/0.000001; You can assume that all the variables a, b, x, y above are of type double. Rewrite this en- tire piece of code as a single expression statement below. In particular, you are not allowed to use the if and else keywords. Hint: Use the ternary operator ? : twice in the above expression. Recall how this operator is used to compute max{a,b}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
