How to create a function of calendar in Matlab ?

7 ビュー (過去 30 日間)
Irfan Tariq
Irfan Tariq 2020 年 6 月 19 日
回答済み: Anmol Dhiman 2020 年 6 月 24 日
how to creat a function for Number of Months of the year, Such that when we find the June and July, Function must declare it as month of summer vacation and when we find the December and January, Function must declare it as month of winter vacation. Otherwise it must show that “ it is time to go to University.

採用された回答

Anmol Dhiman
Anmol Dhiman 2020 年 6 月 24 日
Hi Irfan,
You can use the below code
function calender(month)
if(month == 6 || month == 7)
disp("month of summer vacation");
elseif(month == 1 || month == 12)
disp("month of winter vacation");
else
disp("Wrong inpit. Please enter month from 1 to 12");
end
end
You can refer to functions for more information.
Regards,
Anmol Dhiman

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by