forked from sowon-dev/AlgorithmStudy_Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1067.java
More file actions
43 lines (37 loc) · 1.02 KB
/
c1067.java
File metadata and controls
43 lines (37 loc) · 1.02 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
package codeup100;
import java.util.Scanner;
public class c1067 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
sc.close();
// 풀이방법 2가지
// 첫번째 : 다중 if조건문
if(a>0){
System.out.println("plus");
}else{
System.out.println("minus");
}
if(a%2 == 0){
System.out.println("even");
}else{
System.out.println("odd");
}
// 두번째 : 중첩 if조건문(중복때문에 비효율적임)
if(a>0){
System.out.println("plus");
if(a%2 == 0){
System.out.println("even");
}else{
System.out.println("odd");
}
}else{
System.out.println("minus");
if(a%2 == 0){
System.out.println("even");
}else{
System.out.println("odd");
}
}
}
}