程式設計:輸入某年某月某日判斷這天是這一年的第多少天的流程圖,以及報告表
- 2022-04-12
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
disp(‘這一年不是閏年!’);
jj=0;
elseif (mod(year,4)==0&&mod(x,100)~=0)||(mod(year,400)==0)
disp(‘這一年為閏年!’);
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(‘the day of year:%d。%d。%d is %d\n’,year,month,day,days);