Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer variable min.Assume that all the variables have already been declared and that x, y, and z have been assigned values).

Respuesta :

Answer:

x <= y ? ((x <= z)? min = x: min = z):((y<=z)? min = y : min = z);

Explanation:

The above written code segment assigns the minimum value from x,y and z to the variable min.For doing this I have used conditional operator to find the minimum of these three variables x,y and z and assigns the value of the minimum variable to the variable min.