알고리즘/CodeUp
3개의 숫자를 입력받아 가장 작은 값을 반환
leegeonwoo
2023. 8. 9. 00:59
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] input = sc.nextLine().split(" ");
int a = Integer.parseInt(input[0]);
int b = Integer.parseInt(input[1]);
int c = Integer.parseInt(input[2]);
int min = a < b ? a : b;
min = min < c ? min : c;
System.out.println(min);
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] input = sc.nextLine().split(" ");
int a = Integer.parseInt(input[0]);
int b = Integer.parseInt(input[1]);
int c = Integer.parseInt(input[2]);
System.out.println((a>b?a:b)>c ? (a>b?a:b):c);
}
}
728x90