monthdays - days = 31; otherwise days = -1; end if days...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%2/8/11 % month = input ('What is the month in numbers? ') switch month case {9, 4, 6, 11} days = 30; case {2} leapyear if isleapyear == 1 days = 29; else days = 28; end case {1, 3, 5, 7, 8, 10, 12}
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: days = 31; otherwise days = -1; end if days > 0 fprintf('The number of days in %d is %d.\n', month, days) else error('bad month'); end...
View Full Document

Ask a homework question - tutors are online