반응형
250x250
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 | 31 |
Tags
- 생성자
- 제어문
- 객체
- 이터레이블
- int오류
- 오라클
- 상속
- 연산자
- Join
- getter
- 생성자쓰는이유
- .substring
- ifelse
- HAVING
- SELECT 절
- sql오류
- 겟터
- executeUpdate
- 카카오인턴십
- for문
- 작성순서
- SQL
- setter
- .repeat
- 향상된for문
- 삼항연산자
- 칼럼명에 별칭 지정
- 프로그래머스
- 자바
- Java
Archives
- Today
- Total
CoDream
[자바] 달 일수 출력하기 본문
728x90
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package main;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("==== 제어문 (조건문 - switch)====");
System.out.println("1월~ 12월 까지 중 월을 입력하세요");
// ?월이 몇일까지 있는지 알려주는 프로그램
// 정수입력받기
Scanner sc = new Scanner(System.in);
int month = sc.nextInt();
if (month == 4 || month == 6 || month == 9 || month == 11) {
System.out.println("30까지 있습니다.");
} else if (month == 1 || month == 3 || month == 5 || month == 7 ||month == 8 || month == 10 || month == 12) {
System.out.println("31까지 있습니다.");
} else if (month == 2) {
System.out.println("29일까지 있습니다");
}
}
}
|
cs |
728x90
반응형
'JAVA > JAVA 프로그램 코드' 카테고리의 다른 글
생일 날짜 출력 프로그램 (0) | 2024.02.17 |
---|---|
로또 랜덤 번호 추출 (0) | 2024.02.16 |
키오스크 프로그램 만들기 (0) | 2024.02.16 |
[자바]구구단 (0) | 2024.02.16 |
[자바] 가위바위보 게임 (0) | 2024.02.16 |