정보 나눔

[백준 문제 1330]_자바 두 수 비교하기 본문

프로그래밍(programming)

[백준 문제 1330]_자바 두 수 비교하기

정보나눔중 2020. 12. 1. 01:01
반응형

단계별로 풀어보기

 

2단계 : if문

-1단계 : 두 정수 A와 B가 주어졌을 때, A와 B를 비교

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A,B = 0;
        A = sc.nextInt();
        B = sc.nextInt();
        
        if(A > B){
           System.out.println(">");
        }else if(A < B){
            System.out.println("<");
        }else if(A == B){
            System.out.println("==");
        }
    }
}
 
cs

 

반응형
Comments