1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lilavasa [31]
3 years ago
14

Write a function called valid_date that takes three positive integer scalar inputs year, month, day. If these three represent a

valid date, return a logical true, otherwise false. The name of the output argument is valid. If any of the inputs is not a positive integer scalar, return false as well. Note that every year that is exactly divisible by 4 is a leap year, except for years that are exactly divisible by 100. However, years that are exactly divisible by 400 are also leap years. For example, the year 1900 was not leap year, but the year 2000 was. Note that your solution must not contain any of the date related built-in MATLAB functions
Mathematics
1 answer:
Temka [501]3 years ago
7 0

Answer:

Check the explanation

Step-by-step explanation:

function [valid]=valid_date(y, m, d)

if ~isscalar(y)  || ~isscalar(m)  || ~isscalar(d)  

   valid=false;

   return

end

   if y>=1 && m>=1 && m<=12  && (ismember(m, [4 6 9 11]) && ismember(d, [1:30])) || (ismember(m, [1 3 5 7 8 10 12]) && ismember(d, 1:31))  

   valid=true;

elseif m==2 && (mod(y,4)==0 && mod(y,100)~=0 || mod(y,400)==0 && mod(y,100)==0) && ismember(d, 1:29)  

       valid=true;

   elseif m==2 && ismember(d, 1:28)  

       valid=true;

   else

       valid=false;

       return

   end

   

end

You might be interested in
I needddd HELPPPPP i will give brainlist
Tamiku [17]

Answer:

its D.

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
What is the value of the expression below? (4/5+3/5)+3.5*5
statuscvo [17]

Step-by-step explanation:

(4/5+3/5)+3.5*5

= 7/5+7/2*5

= 7/5+35/2

= 14/10+175/10

= 189/10

= 18.9

8 0
4 years ago
Read 2 more answers
Han made some hot chocolate by mixing 4 cups of milk with 6 tablespoons of cocoa. How many tablespoons of cocoa per cup of milk
jek_recluse [69]

Answer:

.8

Step-by-step explanation:

8 0
3 years ago
What is the standard form for 200,000+80,000+700+6
Over [174]
280,706 is standard form.
I HOPE THIS HELPS!
3 0
3 years ago
Read 2 more answers
If the parent function f(x)= x is modified to g(x)= 2x^2+ 1, which statement is true about g(x)?
snow_lady [41]
I’m not positive but I’m sure it’s D.
7 0
4 years ago
Other questions:
  • Triangle RST was dilated with the origin as the center of dilation to create triangle R'S'T'. The triangle was dilated using a s
    14·1 answer
  • What’s the missing value 2x+3y=12
    10·1 answer
  • 1. the figure below is a parallelogram which statement must be true
    7·1 answer
  • The sum of two numbers is 31 .The different the two numbers is 87 . Find the values of the two numbers.
    8·1 answer
  • Cheryl is now x years old. Her cousin is ⅓ Cheryl’s age. Find her cousin’s age in terms of x.
    14·1 answer
  • Which letter accurately describes how w(x) = log4(x + 5) – 3 is translated from p(x) = log4(x).
    11·1 answer
  • Jamal buys postcards of Washington, D.C., for $14.62, not including tax. Each postcard costs $0.86. How many postcards does Jama
    5·1 answer
  • Jasmine correctly answered 9 out of 10 of the game questions. What percent did she answer correctly.
    10·1 answer
  • Answer asap please!!!
    8·1 answer
  • Nasrin invested $6000 in a bond at a yearly rate of 3%. She earned $450 in interest. How long was the money invested?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!