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
Which statements are accurate about the dilation? Check all that apply. The dilation is a reduction. The scale factor is between
ludmilkaskok [199]

Answer:

A,B,D

Step-by-step explanation:

Trust me just did it on edge

4 0
3 years ago
Read 2 more answers
The length of a photograph is 1 cm less than twice the width. The area is 91cm^2. find the width and length.
maksim [4K]

Answer:

Width=6.5 cm

Length=12 cm

Step-by-step explanation:

Step 1: Express the lengths and widths

Width=w

Length=l, but 1 cm less than twice the width=(2×w)-1=2 w-1

Step 2: Solve for the length and width

A=L×W

where;

A=area of the photograph

L=length of the photograph

W=width of the photograph

In our case;

A=91 cm²

L=2 w-1

W=w

91=(2 w-1)w

2 w²-w=91

2 w²-w-91=0, is a quadratic equation

solve for w

w={-1±√(-1²-4×2×-91)}/(2×2)

w=(-1±27)/4

w=(27-1)/4=6.5, or (-1-27)/4=-8

Take w=6.5 cm

L=(2×6.5)-1=13-1=12 cm

Width=6.5 cm

Length=12 cm

6 0
3 years ago
Victoria is 30 years old. She has $700 in a checking account, $9000 in a savings account $16,000 in a retirement account, and ow
Roman55 [17]

Answer:

B

Step-by-step explanation:

Please mark as brainliest

4 0
2 years ago
Pls help ASAP !! I’m struggling so hard in math class pls help I need it .
Mama L [17]

Answer:

b = 27 degrees

Step-by-step explanation:

90 - 63 = 27

8 0
3 years ago
Read 2 more answers
What is the answer and how can I find it
finlep [7]
The answer is C 
1/2(5x + 12) 

because the perimeter is equal 20x + 6 

4 0
3 years ago
Other questions:
  • For multiplication give three number whose product is 9000
    9·2 answers
  • Please help! Will get brainliest!!!
    12·1 answer
  • If each cube has edges .5 inches long, what is the volume of the prism outlined in blue?
    11·2 answers
  • Find the area of the garden?<br> 16 ft<br> 22 ft
    7·2 answers
  • I need your help to find the value of x.round to the nearest hundred just the photo ​
    10·1 answer
  • Two fair dice are thrown. Let X be a random variable giving the score on the rst die and Y be a random variable giving the large
    10·1 answer
  • PLEASE HELP!!! Needed ASAP!
    14·1 answer
  • Solve for n: 4= -8 + 5n
    15·1 answer
  • Select the more effective use of correlative conjunctions to join these sentences.
    8·2 answers
  • FILL IN THE BLANKS AND TELL ME WHAT THEY ARE!!!! HELP ASAP!!! FIRST PERSON GETS BRAINLIEST ANSWER!! NO LINKS! ASAP!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!