알고리즘/백준
[백준 1330번 ː 자바(JAVA)] 두 수 비교하기
그릿er
2020. 4. 14. 17:01
<문제>
두 정수 A와 B가 주어졌을 때, A와 B를 비교하는 프로그램을 작성하시오.
<출력 조건>
첫째 줄에 다음 세 가지 중 하나를 출력한다.
- A가 B보다 큰 경우에는 '>'를 출력한다.
- A가 B보다 작은 경우에는 '<'를 출력한다.
- A와 B가 같은 경우에는 '=='를 출력한다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a>b) {
System.out.println(">");
}else if(a==b) {
System.out.println("==");
}else if(a<b) {
System.out.println("<");
}
}
}
|