Skip to content

Instantly share code, notes, and snippets.

@ororox
Last active September 18, 2020 01:16
Show Gist options
  • Save ororox/0a7a74c1ede8b793032a7f1c080c6c61 to your computer and use it in GitHub Desktop.
Save ororox/0a7a74c1ede8b793032a7f1c080c6c61 to your computer and use it in GitHub Desktop.
자바 연습문제 풀이 3
public class JavaRunner02 {
public static void main(String[] args) {
/* 입력부 */
int firstNumber = 2;
int secondNumber = 3;
/* 출력변수 */
String prtStr1;
String prtStr2;
String prtStr3;
/* 연산부 */
if (firstNumber >= 2 ) {
prtStr1 = "첫번째 숫자는 2보다 크거나 같다";
} else {
prtStr1 = "첫번째 숫자는 2보다 작다";
}
if (secondNumber > 3 ) {
prtStr2 = "두번째 숫자는 3보다 크다";
} else if (secondNumber > 2) {
prtStr2 = "두번째 숫자는 2보다 크다";
} else if (secondNumber > 1) {
prtStr2 = "두번째 숫자는 1보다 크다";
} else if (secondNumber > 0) {
prtStr2 = "두번째 숫자는 0보다 크다";
} else {
prtStr2 = "두번째 숫자는 음수이다";
}
if (firstNumber > 3 ) {
prtStr3 = "첫번째 숫자는 3보다 크다";
} else if (firstNumber > 0 || firstNumber <= 3) {
prtStr3 = "첫번째 숫자는 2이상 3미만이다";
} else {
prtStr3 = "첫번째 숫자는 음수이다";
}
/* 출력부 */
System.out.println("***************");
System.out.println(prtStr1);
System.out.println(prtStr2);
System.out.println(prtStr3);
System.out.println("***************");
}
}
@ororox
Copy link
Author

ororox commented Sep 18, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment