#include int main(void){ int x, y, z, w; int res1, res2, res3; printf("Enter the integers x, y, z, and w.\n"); scanf("%d%d%d%d", &x, &y, &z, &w); /* min(x,y) */ res1 = (x < y) ? x : y; /* min(x,y,z) = if x < y then min(x,z) y ruled out else min(y,z) x ruled out Now use the pattern from above. */ res2 = (x < y)? ((x < z) ? x : z): ((y < z) ? y : z); /* max(x,y,z,w) = if x < y then max(y,z,w) x ruled out else max(x,z,w) y ruled out max(x,y,z) = if x < y then max(y,z) x ruled out else max(x,z) y ruled out max(x,y) = if x < y then y else x */ res3 = (x < y)? ((y < z) ? ((z < w) ? w : z) : ((y < w) ? w : y)) : ((x < z) ? ((z < w) ? w : z) : ((x < w) ? w : x)); printf("The minimum of %d and %d is %d.\n", x, y, res1); printf("The minimum of %d, %d, and %d is %d.\n", x, y, z, res2); printf("The maximum of %d, %d, %d, and %d is %d.\n", x, y, z, w, res3); }