MATLAB Answers

0

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

zelafafaa 님이 질문을 제출함. 28 Oct 2019
최근 활동 John D'Errico 님이 답변함. 28 Oct 2019
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

로그인 to comment.

답변 수: 1

John D'Errico 님의 답변 28 Oct 2019

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

로그인 to comment.



Translated by