This commit is contained in:
암냥 2026-04-18 22:25:36 +09:00
commit 6fef06ae70
No known key found for this signature in database
67 changed files with 436 additions and 1 deletions

34
04/ex09.c Normal file
View file

@ -0,0 +1,34 @@
#include <stdio.h>
int main() {
int year, month, days;
printf("<윤년 계산>\n");
printf("년도 입력(year) : ");
scanf("%d", &year);
printf("월(Month) 입력 : ");
scanf("%d", &month);
int isLeap = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
switch (month) {
case 1: case 3: case 5: case 7:
case 8: case 10: case 12:
days = 31;
break;
case 4: case 6:
case 9: case 11:
days = 30;
break;
case 2:
days = isLeap ? 29 : 28;
break;
default:
printf("잘못된 월입니다. (1~12 사이 입력)\n");
return 1;
}
printf("%d년 %d월은 %d일까지 있습니다.\n", year, month, days);
return 0;
}