Question: Please show in MATLAB. Thank you! Write a function that takes a month, day, and year as inputs and returns the number of days that


Please show in MATLAB. Thank you!
Write a function that takes a month, day, and year as inputs and returns the number of days that have passed since January 1, 780, the year al-Khwarizmi, the "father of algebra", was born (include the 1/1/780 date as day 1). This function should include a subroutine" to deal with all leap year calculations. The subroutine is a function that will take a year as an input and will return a 1 if that year is a leap year or a 0 if that year is not a leap year. This code was completed in MGHW3. As a check, the number of days between 1/1/780 and 6/21/2011 is 449,786. function d = daycount (day, month, year) %start counter at 0 d = 0; %add either 365 or 366 for each year from 780 to year-1 %call function leap (defined below) to determine leap years %add either 28, 29, 30, or 31 days each month in current year from January to month-1 %call function leap (defined below) to determine leap years %add days in current month end function yesno = leap(year) %set yesno to 1 if year is a leap year %set yesno to 0 if year is not a leap year end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
