Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.52 KB | None | 0 0
  1. % Written by: Natalie Sursock; ID:28826728
  2. % Last modified 22/3/2018
  3. % Computes whether given year is a leap year.
  4.  
  5. %Input arguments
  6. %----------------
  7. %inputs: year in YYYY format
  8.  
  9. %Output arguments
  10. %----------------
  11. %output: leapyeartrue; outputs integer 0 or 1. 0 if year is a leap year and
  12. %1 if given year isn't a leap year.
  13.  
  14. if mod(year,4) == 0
  15.     leap = 1;
  16.     if mod(year,100) == 0
  17.         leap = 0;
  18.         if mod(year,400) == 0
  19.             leap = 1;
  20.         end
  21.     end
  22.    
  23. else
  24.     leap = 0;
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement