I'm trying to write a function that determines if the input is a valid date, and for that I need a function that will tell me if an input number is divisible by 4 and at the same time not divisible by 100 (this has to do with leap years but I'm not supposed to use the special function for that). This is what I came up with but I can already see that it's not correct. In non-code language, I would like it to be something like "If divisors(year) contains the number 4 and does not contain the number 100, display the following…" but I did not know how to do this.
(This is just the part of code I'm struggling with, I didn't paste everything because it was quite a lot.)
Any tips on how I should fix it would be much appreciated!
function valid = valid_date(year,month,day)if divisors(year) = 4 ~ 100 . . ...end
Best Answer