반응형
import java.util.Scanner;
public class Baekjoon1330 {
public static void main(String[] args) {
// 두 정수 A와 B가 주어졌을 때, A와 B를 비교하는 프로그램을 작성하시오.
Scanner sc = new Scanner(System.in);
System.out.print("첫번째 수를 입력해주세요 : ");
int n1 = sc.nextInt();
sc.nextLine();
System.out.print("두번째 수를 입력해주세요 : ");
int n2 = sc.nextInt();
if(n1 < n2) {
System.out.print("<");
} else if(n1 > n2) {
System.out.print(">");
} else {
System.out.print("==");
}
}
}
// 쉬운.. 난이도
두 수를 스캐너로 입력받아서 if 문으로 비교하여 출력한다.
반응형
'Algorithm > Baekjoon' 카테고리의 다른 글
[Baekjoon Algorithm] 백준 알고리즘 2562번 배열의 최대값과 순번을 출력하시오 (0) | 2020.11.24 |
---|---|
[Baekjoon Algorithm] 백준 알고리즘 10818번 문제 배열의 최대값, 최소값 구하기 (0) | 2020.11.23 |
[Baekjoon Algorithm] 백준 알고리즘 2741번 문제 1부터 n까지의 수 한줄씩 출력 (0) | 2020.11.23 |
[Baekjoon Algorithm] 백준 알고리즘 2742번 문제 자연수 N이 주어졌을 때, N부터 1까지 한 줄 (0) | 2020.11.23 |
[Baekjoon Algorithm] 백준 알고리즘 8393번 문제 1부터 n까지의 덧셈을 구하시오 (0) | 2020.11.23 |