LeapDays - if (y < 2100) noLD = ceil((y - 1900)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%Count the number of leap year days between Jan 1, 1900, and % Dec 31 of the inputted year in the 21st century, inclusive. % noLD = 0; %number of leap days y = input('Enter a year from 1900 to 2099, inclusive: '); % caluculate the n of leap days
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (y < 2100) noLD = ceil((y - 1900) / 4); else noLD = floor((y - 1900) / 4) - 1; end fprintf('# of leap year days from 1/1/1900 to 12/31/%d = %d\n', y, noLD); %fprintf('# of leap year days from 1/1/%d to 12/31/2199 = %d\n', y, x);...
View Full Document

This note was uploaded on 03/15/2011 for the course COM S 100 at Cornell University (Engineering School).

Ask a homework question - tutors are online