|
|
| File Information |
| Description |
A script to assess if a given year (in the Gregorian Calendar system) is a leap year or not.
It returns 0 if is not a leap year,
it returns 1 if it is a leap year.
Examples:
>> isleap(1900)
ans =
0
>> A = [1200 1538 2001 ; 816 1900 1908 ; 2000 2004 2011]
A =
1200 1538 2001
816 1900 1908
2000 2004 2011
>> isleap(A)
ans =
1 0 0
1 0 1
1 1 0
It looks at the remainder of the division, if the year is divisible by 4, 100 and 400 and makes the decision according to it. (For a year ending in 00 is not a leap year unless is divisible for 400 too). |
| MATLAB release |
MATLAB 7.1.0 (R14SP3)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 15 Jun 2011 |
I deleted unnecessary code, now it's a one line code. |
|
Contact us at files@mathworks.com