I'm needing a to write a function that takes in a start and end year, and that outputs the leap years in-between those 2 parameters. I feel like I have a good base, but I can't figure out how to include that a year is not a leap year if it is divisible by 100. I have 2 potential ideas as to how to approach the task, but This is what I have so far:
function [] = leapyears(startYear,endYear)for x=startYear-1:4:endYear-1 fprintf('%i \n', x+1); if mod(startYear,100)==0%y=0;
%while y<startYear
%if mod(startYear, 4) == 0 && mod(startYear, 400)==0 && mod(startYear,100)==0
%for x=startYear-1:4:endYear-1
%fprintf('%i \n', x+1);
%end
%y=y+1
%endend
Best Answer