/* * Program to print three integers in ascending order. * * (This version essentially does a bubble sort of the three inputs.) */ #include #include /* has EXIT_SUCCESS, EXIT_FAILURE */ int main(void) { int x, y, z, temp; printf("enter three integers:\n"); if (scanf("%d %d %d", &x, &y, &z) != 3) { printf("invalid input\n"); return EXIT_FAILURE; } printf("input %d %d %d\n", x, y, z); if (x > y) { temp = x; x = y; y = temp; } if (y > z) { temp = y; y = z; z = temp; } if (x > y) { temp = x; x = y; y = temp; } printf("in order %d %d %d\n", x, y, z); return EXIT_SUCCESS; }