matlab程序问题

任意输入3个整数分别代表年、月、日,计算并输出这天是该年的第几天?(1月1日是这一年的第一天)。

输入样例:

2021 5 13

输出样例:

133 用matlab程序该如何写


year=input('please input the value of year:');
month=input('please input the value of month:');
day=input('please input the value of day:');
days=day;
if (mod(year,100)==0&&mod(year,400)~=0)||mod(year,4)~=0
        jj=0;
else
        jj=1;
end
for i=1:month-1
    switch(i)
        case {1,3,5,7,8,10,12},
            days=days+31;
         case {4,6,9,11},
             days=days+30;
        case 2,
            days=days+28+jj;
    end
end
fprintf('%d.%d.%d 是第 %d 天\n',year,month,day,days);

如果对你有帮助,可以点击我这个回答右上方的【采纳】按钮,给我个采纳吗,谢谢