필터 지우기
필터 지우기

Array of the number of days in the month of February this year

조회 수: 4 (최근 30일)
Haley Kelly
Haley Kelly 2021년 10월 14일
답변: RANGA BHARATH 2023년 6월 12일
The number of days in the month of February this year

답변 (2개)

Star Strider
Star Strider 2021년 10월 14일
Numer of days: eomday
Array of days: calendar
.

RANGA BHARATH
RANGA BHARATH 2023년 6월 12일
Hi @Haley Kelly. Below is the solution for your question.
Question: How many days are there in the February month this year?
Solution:
A year is a leap year if the following conditions are satisfied:
  1. The year is multiple of 400.
  2. The year is multiple of 4 and not multiple of 100.
Code:
year = int64(input("Enter the year: "));
num_days_in_feb = 28;
%% mod(a,b) returns the remainder when a is divided by b
if(mod(year,400)==0)
num_days_in_feb = 29;
elseif(mod(year,100)~=0 && mod(year,4)==0)
num_days_in_feb = 29;
end
fprintf("Number of days in February in the year %d = %d",year,num_days_in_feb);

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by