Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 기초프로그래밍
- 코드업100제자바
- 프로그래머스파이썬
- 디자인패턴
- Codeup
- 제어구조
- 자바클래스
- 코드업자바
- Literal
- SWEA파이썬
- 사용자입력
- 코딩테스트
- VARIABLE
- 변수
- 알고리즘
- SWEA
- 수학연산
- 코드업
- 백준
- 백준파이썬
- 개발입문
- 리터럴
- Algorithm
- Java
- C#프로그래밍
- 코드업100제
- c#
- 자바연산자
- C#변수
- 자바
Archives
- Today
- Total
제니노트
[기초-비교연산] 1049-1052 [자바] 본문
반응형
1049
두 정수(a, b)를 입력받아
a가 b보다 크면 1을, a가 b보다 작거나 같으면 0을 출력하는 프로그램을 작성해보자.
import java.io.*;
import java.util.*;
//1049
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("1");
else
System.out.println("0");
}
}
1050
두 정수(a, b)를 입력받아
a와 b가 같으면 1을, 같지 않으면 0을 출력하는 프로그램을 작성해보자.
import java.io.*;
import java.util.*;
//1050
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("1");
else
System.out.println("0");
}
}
1051
두 정수(a, b)를 입력받아
b가 a보다 크거나 같으면 1을, 그렇지 않으면 0을 출력하는 프로그램을 작성해보자.
import java.io.*;
import java.util.*;
//1051
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("1");
else
System.out.println("0");
}
}
1052
두 정수(a, b)를 입력받아
a와 b가 서로 다르면 1을, 그렇지 않으면 0을 출력하는 프로그램을 작성해보자.
import java.io.*;
import java.util.*;
//1052
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("1");
else
System.out.println("0");
}
}
반응형
'코딩테스트 > 코드업' 카테고리의 다른 글
[기초-비트단위논리연산] 1059-1062 [자바] (0) | 2023.01.17 |
---|---|
[기초 - 논리연산] 1053 - 1058 [자바] (0) | 2023.01.17 |
[기초 - 비트시프트연산] 1047-1048 [자바] (0) | 2023.01.17 |
[기초-산술연산] 1038-1046 [자바] (0) | 2023.01.17 |
[기초-출력변환] 1031-1037 [자바] (0) | 2023.01.17 |
Comments