if year is divisible by 400 - then is a leap year if year is divisible by 100 - then is not a leap year if year is divisible by 4 - then is a leap year
조회 수: 14 (최근 30일)
이전 댓글 표시
if year is divisible by 400 - then is a leap year
if year is divisible by 100 - then is not a leap year
if year is divisible by 4 - then is a leap year
All other cases – not leap year
i cannot figure out how to write a if loop for finding out if something is divisibly by anything. i knw there is a function to figure out if a year is a leap year but i have to code it this way specifically
댓글 수: 0
답변 (1개)
John D'Errico
2019년 10월 28일
Hint: What does the mod function tell you? Specifially, if mod(Y,4)==0, what would that tell you? Similarly, what would it tell you if mod(y,100)==0 tell you? Finally, what does this mod(y,400)==0 tell you?
Your homework, not mine, although I would argue I just gave you the answer, IF you think about what I wrote.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calendar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!