Write a function that tells if the date defined by a day d, month m and year y is valid or not.
Interface
C++ | bool is_valid_date(int d, int m, int y); |
C | int is_valid_date(int d, int m, int y); |
Java | public static boolean isValidDate(int d, int m, int y); |
Python | is_valid_date(d, m, y) # returns bool |
is_valid_date(d: int, m: int, y: int) -> bool |
To write this function, it is convinient to use the function for leap years of the exercise .
Precondition The parameter y is between 1800 and 9999, both included.
Observation You only need to submit the required procedure; your main program will be ignored.
Input/Output