3개의 숫자를 입력받아 가장 작은 값을 반환알고리즘/CodeUp2023. 8. 9. 00:59
Table of Contents
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
'알고리즘 > CodeUp' 카테고리의 다른 글
CodeUp 1057 - Java (0) | 2023.08.08 |
---|
@leegeonwoo :: geonwoo
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!