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
- hash table
- 자바
- Number Theory
- java
- two pointers
- geometry
- Data Structure
- 파이썬
- Counting
- database
- 코딩테스트
- Class
- Method
- SQL
- array
- bit manipulation
- 코테
- string
- Binary Tree
- implement
- Math
- Binary Search
- Stack
- 구현
- greedy
- Matrix
- dynamic programming
- sorting
- Tree
- simulation
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 홀짝 구분하기 본문
1. Input, Output, Example
- n이 짝수이면 "n is even"을, 홀수이면 "n is odd"를 출력하는 코드를 작성
2. Constraint
1) 1 ≤ n ≤ 1,000
3. Code
1) 첫 코드(2023/04/24)
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n%2==0)
System.out.print(n+" is even");
else
System.out.print(n+" is odd");
}
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 주사위 게임 3 (0) | 2023.04.24 |
---|---|
[프로그래머스/Lv.0] 뒤에서 5등 위로 (0) | 2023.04.24 |
[프로그래머스/Lv.0] 카운트 다운 (0) | 2023.04.24 |
[프로그래머스/Lv.0] 문자열 정수의 합 (0) | 2023.04.24 |
[프로그래머스/Lv.0] 글자 이어 붙여 문자열 만들기 (0) | 2023.04.24 |