1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int num3 = sc.nextInt(); int temp = 0; if(num2 < num1){ temp = num2; num2 = num1; num1 = temp; } if(num3 < num1){ temp = num3; num3 = num1; num1 = temp; } if(num3 < num2){ temp = num3; num3 = num2; num2 = temp; } System.out.print(num2); } } | cs |
프로그래밍 문제/백준