% This file computes the number of leap years since 1900
% input is retricted from 1900 to 2199 in years

year = input('input year (from 1900 to 2199): ');

numLeapYears = 0;

if(year < 2100)
    numLeapYears = floor((year - 1900)/4);
else
    % we do this because 2100 is not a leap year but our method of
    % counting leap years always counts every 4th year, so we need to 
    % correct that by subtracting one
    numLeapYears = floor((year - 1900)/4) - 1;
end

% "%d" refers to whole numbers, so each %d is replaced by a number in 
% the arguments which follow the string in the order that the %d is seen
% so the first %d is replaced with year and the second by numLeapYears
fprintf('Number of leap years from 1900 to %d is %d.\n', year, numLeapYears);