본문 바로가기

Algorithm/백준

[백준] 1330번: 두 수 비교하기 - JAVA [자바]

 


 

문제


 

 

 

문제 풀이


 

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        //(1)
        if(a>b){
            System.out.println(">");
        }
        //(2)
        if(a<b){
            System.out.println("<");
        }
        //(3)
        if(a==b){
            System.out.println("==");
        }
        //(4)

    }
}

 

  1. a, b 두 수를 입력합니다.
  2. a > b 일 시 ">"를 출력합니다.
  3. a < b 일 시 "<"를 출력합니다.
  4. a == b 일 시 "=="를 출력합니다.

 

결과