Please solve the problem by using Matlab Compute leap years

Please solve the problem by using Matlab

Compute leap years. Write a function (leapyears) that takes two integer arguments (start year and end year) and prints a list of the leap years that occur between them (inclusive of the start and end year). Leap years are divisible by 4. Except that years divisible by 100 are not leap years unless they are also divisible by 400.

Solution

function f = leapyears(startyr,endyr)

i=startyr

while(i<=endyr)

if((i%4==0)||(i%100==0&&i%400==0))

fprintf(\"%d\",i)

end

i=i+1

end

end

Please solve the problem by using Matlab Compute leap years. Write a function (leapyears) that takes two integer arguments (start year and end year) and prints

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site