matlab_判断闰年(function judgeLeapYear)

matlab 判断闰年

function judgeLeapYear(year)
%输入待判断的年份year
%调用格式为judgeLeapYear(year)
%如果是闰年,打印yes!
%否则打印no
if( (mod(year,4) == 0 &  mod(year,100)~=0) |  mod(year,400)==0)
    'yes!' %也可以disp(yes)
else
    disp('no')
end
posted @ 2024-03-15 15:00  xuchaoxin1375  阅读(52)  评论(0)    收藏  举报  来源