Skip to content

Instantly share code, notes, and snippets.

@folivetti
Created February 17, 2017 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save folivetti/7e146a02af08f461c388d7f910806f82 to your computer and use it in GitHub Desktop.
Save folivetti/7e146a02af08f461c388d7f910806f82 to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int x, y, z;
Scanner sc = new Scanner(System.in);
x = sc.nextInt();
y = sc.nextInt();
z = sc.nextInt();
if (x <= y && x <= z) {
if (y <= z) {
System.out.printf("%d\n%d\n%d\n", x, y, z);
} else {
System.out.printf("%d\n%d\n%d\n", x, z, y);
}
} else if (y <= x && y <= z) {
if (x <= z) {
System.out.printf("%d\n%d\n%d\n", y, x, z);
} else {
System.out.printf("%d\n%d\n%d\n", y, z, x);
}
} else if (x <= y) {
System.out.printf("%d\n%d\n%d\n", z, x, y);
} else {
System.out.printf("%d\n%d\n%d\n", z, y, x);
}
System.out.printf("\n%d\n%d\n%d\n", x, y, z);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment