[BOJ][1330] 두 수 비교하기
Updated:
1. 문제 링크
https://www.acmicpc.net/problem/1330
2. 사용 알고리즘
구현
3. 풀이
조건문을 이용하여 두 수를 비교한 후 출력
4. 소스 코드
4-1. C++
https://github.com/dev-aiden/problem-solving/blob/main/boj/1330.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int a, b; cin >> a >> b;
if (a > b) cout << ">" << "\n";
else if (a < b) cout << "<" << "\n";
else cout << "==" << "\n";
return 0;
}
4-2. JAVA
https://github.com/dev-aiden/problem-solving/blob/main/boj/1330.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
if(a > b) System.out.println(">");
else if(a < b) System.out.println("<");
else System.out.println("==");
}
}
Leave a comment