Question: 3-3 Please do the coding in C language! Ternary/conditional operator ?: works like if .. else. Here is an example, which finds the maximum of

3-3

Please do the coding in C language!

3-3 Please do the coding in C language! Ternary/conditional operator ?: works

Ternary/conditional operator ?: works like if .. else. Here is an example, which finds the maximum of two numbers. It shows how can it be written using if else, and ?: both. #include int main() {int max, a = 10, b = 20;//get value for a and b from user//using if else if (a > b) {max = a;} else {max = b;}//using ternary operator max = (a > b) ? a: b;//what is the value of max? printf ("The Max is: %d ", max); return 0;} Re-write the above ternary operator code to find the max of three numbers, for example, a, b. and c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!