#include <stdio.h>
int main() {
int m, sd, ld;
int p=1;
scanf("%d %d", &m, &sd);
switch (m) {
case 1: case 3: case 5: case 7: case 8: case 10 :case 12:
ld=31;
break;
case 4: case 6: case 9: case 11:
ld=30;
break;
case 2:
ld=28;
break;
default:
return 1;}
printf("[%d월 달력]\n", m);
printf("1\t2\t3\t4\t5\t6\t7\n");
printf("일\t월\t화\t수\t목\t금\t토\n");
for (int i = 1; i < sd; i++) {
printf("\t");
p++;
}
for (int day = 1; day <= ld; day++) {
printf("%d\t", day);
if (p % 7 == 0) {
printf("\n");
}
p++;
}
printf("\n");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: