C
c
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
#include <stdio.h>
#include <string.h>
typedef struct {
char name[10];
int days, n;
} m;
int num_month(char *a) {
int n = 0;
if(strcmp(a,"January") == 0) n = 1;
if(strcmp(a,"February") == 0) n = 2;
if(strcmp(a,"March") == 0) n = 3;
if(strcmp(a,"April") == 0) n = 4;
if(strcmp(a,"May") == 0) n = 5;
if(strcmp(a,"June") == 0) n = 6;
if(strcmp(a,"July") == 0) n = 7;
if(strcmp(a,"August") == 0) n = 8;
if(strcmp(a,"September") == 0) n = 9;
if(strcmp(a,"October") == 0) n = 10;
if(strcmp(a,"November") == 0) n = 11;
if(strcmp(a,"December") == 0) n = 12;
return n;
}
int day_in_month(int month, int year) {
if (month == 2) // February with leap year consideration
return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run